mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-19 12:04:02 +08:00
MessageBox: add distinguishCancelAndClose (#11831)
This commit is contained in:
@@ -29,7 +29,8 @@ const defaults = {
|
||||
beforeClose: null,
|
||||
dangerouslyUseHTMLString: false,
|
||||
center: false,
|
||||
roundButton: false
|
||||
roundButton: false,
|
||||
distinguishCancelAndClose: false
|
||||
};
|
||||
|
||||
import Vue from 'vue';
|
||||
@@ -59,7 +60,7 @@ const defaultCallback = action => {
|
||||
} else {
|
||||
currentMsg.resolve(action);
|
||||
}
|
||||
} else if (action === 'cancel' && currentMsg.reject) {
|
||||
} else if (currentMsg.reject && (action === 'cancel' || action === 'close')) {
|
||||
currentMsg.reject(action);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,8 +22,8 @@
|
||||
class="el-message-box__headerbtn"
|
||||
aria-label="Close"
|
||||
v-if="showClose"
|
||||
@click="handleAction('cancel')"
|
||||
@keydown.enter="handleAction('cancel')">
|
||||
@click="handleAction(distinguishCancelAndClose ? 'close' : 'cancel')"
|
||||
@keydown.enter="handleAction(distinguishCancelAndClose ? 'close' : 'cancel')">
|
||||
<i class="el-message-box__close el-icon-close"></i>
|
||||
</button>
|
||||
</div>
|
||||
@@ -173,7 +173,7 @@
|
||||
|
||||
handleWrapperClick() {
|
||||
if (this.closeOnClickModal) {
|
||||
this.handleAction('cancel');
|
||||
this.handleAction(this.distinguishCancelAndClose ? 'close' : 'cancel');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -319,7 +319,8 @@
|
||||
callback: null,
|
||||
dangerouslyUseHTMLString: false,
|
||||
focusAfterClosed: null,
|
||||
isOnComposition: false
|
||||
isOnComposition: false,
|
||||
distinguishCancelAndClose: false
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user