Effect picture:
[OK] button executes logic A, [Cancel] button executes logic B. The [x] button closes the confirm, and the cancel button executes different logic codes as follows:
this.$confirm("是否确定删除选中的数据?", "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
type: "warning",
distinguishCancelAndClose: true, // 重要,设置为true才会把右上角X和取消区分开来
closeOnClickModal: false
}).then(function () {
// TODO 确认通过执行逻辑
}).catch(function (e) {
if (e == 'cancel') {
// TODO 确认不通过执行逻辑
} else if(e == 'close') {
// TODO 右上角X的执行逻辑
}
})