diff --git a/src/components/modal/modal.vue b/src/components/modal/modal.vue index a2a75dfd..8592c2f0 100644 --- a/src/components/modal/modal.vue +++ b/src/components/modal/modal.vue @@ -40,7 +40,7 @@ import { on, off } from '../../utils/dom'; import { findComponentsDownward } from '../../utils/assist'; - import { transferIndex as modalIndex, transferIncrease as modalIncrease } from '../../utils/transfer-queue'; + import { transferIndex as modalIndex, transferIncrease as modalIncrease, lastVisibleIndex, lastVisibleIncrease } from '../../utils/transfer-queue'; const prefixCls = 'ivu-modal'; @@ -343,6 +343,10 @@ }, handleClickModal () { if (this.draggable) { + if (lastVisibleIndex !== this.lastVisibleIndex){ + this.lastVisibleIndex = lastVisibleIndex; + return; + } this.modalIndex = this.handleGetModalIndex(); } } @@ -379,7 +383,10 @@ this.removeScrollEffect(); }, 300); } else { - this.modalIndex = this.handleGetModalIndex(); + if (this.lastVisible !== val) { + this.modalIndex = this.handleGetModalIndex(); + lastVisibleIncrease(); + } if (this.timer) clearTimeout(this.timer); this.wrapShow = true; @@ -390,6 +397,8 @@ this.broadcast('Table', 'on-visible-change', val); this.broadcast('Slider', 'on-visible-change', val); // #2852 this.$emit('on-visible-change', val); + this.lastVisible = val; + this.lastVisibleIndex = lastVisibleIndex; }, loading (val) { if (!val) { diff --git a/src/utils/transfer-queue.js b/src/utils/transfer-queue.js index b11bdf7c..8ca94131 100644 --- a/src/utils/transfer-queue.js +++ b/src/utils/transfer-queue.js @@ -1,7 +1,12 @@ let transferIndex = 0; +let lastVisibleIndex = 0; function transferIncrease() { transferIndex++; } -export {transferIndex, transferIncrease}; \ No newline at end of file +function lastVisibleIncrease() { + lastVisibleIndex++; +} + +export { transferIndex, transferIncrease, lastVisibleIndex, lastVisibleIncrease }; \ No newline at end of file