mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-19 12:04:02 +08:00
Dialog: add before-close (#4423)
This commit is contained in:
@@ -11,7 +11,7 @@
|
||||
<span class="el-dialog__title">{{title}}</span>
|
||||
</slot>
|
||||
<div class="el-dialog__headerbtn">
|
||||
<i v-if="showClose" class="el-dialog__close el-icon el-icon-close" @click='close()'></i>
|
||||
<i v-if="showClose" class="el-dialog__close el-icon el-icon-close" @click='handleClose'></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="el-dialog__body" v-if="rendered"><slot></slot></div>
|
||||
@@ -81,7 +81,8 @@
|
||||
top: {
|
||||
type: String,
|
||||
default: '15%'
|
||||
}
|
||||
},
|
||||
beforeClose: Function
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
@@ -119,7 +120,13 @@
|
||||
|
||||
methods: {
|
||||
handleWrapperClick() {
|
||||
if (this.closeOnClickModal) {
|
||||
if (!this.closeOnClickModal) return;
|
||||
this.handleClose();
|
||||
},
|
||||
handleClose() {
|
||||
if (typeof this.beforeClose === 'function') {
|
||||
this.beforeClose(this.close);
|
||||
} else {
|
||||
this.close();
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user