ソースを参照

catch errors when evaluating dynamic props (fixes #1950)

Falko Schindler 1 年間 前
コミット
188629db2d
1 ファイル変更7 行追加2 行削除
  1. 7 2
      nicegui/templates/index.html

+ 7 - 2
nicegui/templates/index.html

@@ -140,8 +140,13 @@
         };
         };
         Object.entries(props).forEach(([key, value]) => {
         Object.entries(props).forEach(([key, value]) => {
           if (key.startsWith(':')) {
           if (key.startsWith(':')) {
-            props[key.substring(1)] = eval(value);
-            delete props[key];
+            try {
+              props[key.substring(1)] = eval(value);
+              delete props[key];
+            }
+            catch (e) {
+              console.error(`Error while converting ${key} attribute to function:`, e);
+            }
           }
           }
         });
         });
         element.events.forEach((event) => {
         element.events.forEach((event) => {