Ver Fonte

Merge pull request #2505 from bmaranville/plotly_event_handler_fix

Register plotly event handlers only once, at mount
Falko Schindler há 1 ano atrás
pai
commit
02376e9230
1 ficheiros alterados com 5 adições e 3 exclusões
  1. 5 3
      nicegui/elements/plotly.vue

+ 5 - 3
nicegui/elements/plotly.vue

@@ -23,8 +23,13 @@ export default {
         Plotly.react(this.$el.id, this.options.data, this.options.layout);
       } else {
         Plotly.newPlot(this.$el.id, this.options.data, this.options.layout, options.config);
+        this.set_handlers();
       }
 
+      // store last options
+      this.last_options = options;
+    },
+    set_handlers() {
       // forward events
       for (const name of [
         // source: https://plotly.com/javascript/plotlyjs-events/
@@ -60,9 +65,6 @@ export default {
           this.$emit(name, args);
         });
       }
-
-      // store last options
-      this.last_options = options;
     },
   },
   data() {