Commit bb060b98bcfd6b0f52d1a33a9989a93b23137cb9
1 parent
55fe310a
fix #5800, close #5647
Showing
1 changed file
with
9 additions
and
1 deletions
Show diff stats
src/components/modal/modal.vue
@@ -5,7 +5,7 @@ | @@ -5,7 +5,7 @@ | ||
5 | </transition> | 5 | </transition> |
6 | <div :class="wrapClasses" :style="wrapStyles" @click="handleWrapClick"> | 6 | <div :class="wrapClasses" :style="wrapStyles" @click="handleWrapClick"> |
7 | <transition :name="transitionNames[0]" @after-leave="animationFinish"> | 7 | <transition :name="transitionNames[0]" @after-leave="animationFinish"> |
8 | - <div :class="classes" :style="mainStyles" v-show="visible"> | 8 | + <div :class="classes" :style="mainStyles" v-show="visible" @mousedown="handleMousedown"> |
9 | <div :class="contentClasses" ref="content" :style="contentStyles" @click="handleClickModal"> | 9 | <div :class="contentClasses" ref="content" :style="contentStyles" @click="handleClickModal"> |
10 | <a :class="[prefixCls + '-close']" v-if="closable" @click="close"> | 10 | <a :class="[prefixCls + '-close']" v-if="closable" @click="close"> |
11 | <slot name="close"> | 11 | <slot name="close"> |
@@ -140,6 +140,7 @@ | @@ -140,6 +140,7 @@ | ||
140 | dragging: false | 140 | dragging: false |
141 | }, | 141 | }, |
142 | modalIndex: this.handleGetModalIndex(), // for Esc close the top modal | 142 | modalIndex: this.handleGetModalIndex(), // for Esc close the top modal |
143 | + isMouseTriggerIn: false, // #5800 | ||
143 | }; | 144 | }; |
144 | }, | 145 | }, |
145 | computed: { | 146 | computed: { |
@@ -243,10 +244,17 @@ | @@ -243,10 +244,17 @@ | ||
243 | } | 244 | } |
244 | }, | 245 | }, |
245 | handleWrapClick (event) { | 246 | handleWrapClick (event) { |
247 | + if (this.isMouseTriggerIn) { | ||
248 | + this.isMouseTriggerIn = false; | ||
249 | + return; | ||
250 | + } | ||
246 | // use indexOf,do not use === ,because ivu-modal-wrap can have other custom className | 251 | // use indexOf,do not use === ,because ivu-modal-wrap can have other custom className |
247 | const className = event.target.getAttribute('class'); | 252 | const className = event.target.getAttribute('class'); |
248 | if (className && className.indexOf(`${prefixCls}-wrap`) > -1) this.handleMask(); | 253 | if (className && className.indexOf(`${prefixCls}-wrap`) > -1) this.handleMask(); |
249 | }, | 254 | }, |
255 | + handleMousedown () { | ||
256 | + this.isMouseTriggerIn = true; | ||
257 | + }, | ||
250 | cancel () { | 258 | cancel () { |
251 | this.close(); | 259 | this.close(); |
252 | }, | 260 | }, |