This commit is contained in:
梁灏 2019-05-21 10:53:27 +08:00
parent 55fe310a5e
commit bb060b98bc

View file

@ -5,7 +5,7 @@
</transition> </transition>
<div :class="wrapClasses" :style="wrapStyles" @click="handleWrapClick"> <div :class="wrapClasses" :style="wrapStyles" @click="handleWrapClick">
<transition :name="transitionNames[0]" @after-leave="animationFinish"> <transition :name="transitionNames[0]" @after-leave="animationFinish">
<div :class="classes" :style="mainStyles" v-show="visible"> <div :class="classes" :style="mainStyles" v-show="visible" @mousedown="handleMousedown">
<div :class="contentClasses" ref="content" :style="contentStyles" @click="handleClickModal"> <div :class="contentClasses" ref="content" :style="contentStyles" @click="handleClickModal">
<a :class="[prefixCls + '-close']" v-if="closable" @click="close"> <a :class="[prefixCls + '-close']" v-if="closable" @click="close">
<slot name="close"> <slot name="close">
@ -140,6 +140,7 @@
dragging: false dragging: false
}, },
modalIndex: this.handleGetModalIndex(), // for Esc close the top modal modalIndex: this.handleGetModalIndex(), // for Esc close the top modal
isMouseTriggerIn: false, // #5800
}; };
}, },
computed: { computed: {
@ -243,10 +244,17 @@
} }
}, },
handleWrapClick (event) { handleWrapClick (event) {
if (this.isMouseTriggerIn) {
this.isMouseTriggerIn = false;
return;
}
// use indexOf,do not use === ,because ivu-modal-wrap can have other custom className // use indexOf,do not use === ,because ivu-modal-wrap can have other custom className
const className = event.target.getAttribute('class'); const className = event.target.getAttribute('class');
if (className && className.indexOf(`${prefixCls}-wrap`) > -1) this.handleMask(); if (className && className.indexOf(`${prefixCls}-wrap`) > -1) this.handleMask();
}, },
handleMousedown () {
this.isMouseTriggerIn = true;
},
cancel () { cancel () {
this.close(); this.close();
}, },