Selaa lähdekoodia

catch errors when evaluating dynamic props (fixes #1950)

Falko Schindler 1 vuosi sitten
vanhempi
säilyke
188629db2d
1 muutettua tiedostoa jossa 7 lisäystä ja 2 poistoa
  1. 7 2
      nicegui/templates/index.html

+ 7 - 2
nicegui/templates/index.html

@@ -140,8 +140,13 @@
         };
         Object.entries(props).forEach(([key, value]) => {
           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) => {