Sfoglia il codice sorgente

Dialog: fix incorrect updatePopper calls

Leopoldthecoder 8 anni fa
parent
commit
f9b19d9aa1

+ 3 - 1
packages/dropdown/src/dropdown-menu.vue

@@ -16,7 +16,9 @@
     mixins: [Popper],
 
     created() {
-      this.$on('updatePopper', this.updatePopper);
+      this.$on('updatePopper', () => {
+        if (this.showPopper) this.updatePopper();
+      });
       this.$on('visible', val => {
         this.showPopper = val;
       });

+ 3 - 1
packages/select/src/select-dropdown.vue

@@ -57,7 +57,9 @@
     mounted() {
       this.referenceElm = this.$parent.$refs.reference.$el;
       this.$parent.popperElm = this.popperElm = this.$el;
-      this.$on('updatePopper', this.updatePopper);
+      this.$on('updatePopper', () => {
+        if (this.$parent.visible) this.updatePopper();
+      });
       this.$on('destroyPopper', this.destroyPopper);
     }
   };