第一种:$confirm()用法
handleClose() {
if (isChange) {
this.dialogVisible = true;
this.$confirm('是否关闭?您所做的更改并未保存。', '确认信息', {
distinguishCancelAndClose: true,
confirmButtonText: '保存',
cancelButtonText: '关闭',
showClose: false,
})
.then(() => {
this.handleSave();
this.dialogVisible = false;
isChange = false;
})
.catch(action => {
this.dialogVisible = false;
this.updateSelectedList();
isChange = false;
})
}
},
第二种:$alert()用法
handleSave() {
batchSaveApi(this.selectedList).then(res => {
this.updateQuickNav();
this.$alert('快捷键设置成功!', '消息', {
confirmButtonText: '确定',
callback: ()=> {
this.dialogVisible = false;
}
});
});
isChange = false;
},