소스 검색

Dialog: fix incorrect updatePopper calls

Leopoldthecoder 8 년 전
부모
커밋
f9b19d9aa1
2개의 변경된 파일6개의 추가작업 그리고 2개의 파일을 삭제
  1. 3 1
      packages/dropdown/src/dropdown-menu.vue
  2. 3 1
      packages/select/src/select-dropdown.vue

+ 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);
     }
   };