vant框架彈出框Dialog的異步請求操作
vant框架的彈出框Dialog的異步請求代碼:
delMsg() {
this.$dialog.confirm({
title: '確認刪除嗎',
message: '刪除后消息不可恢復,是否繼續該操作',
confirmButtonColor: '#2693ff',
closeOnClickOverlay: true,
beforeClose: this.beforeClose,
})
// .then(() => {
// //確認刪除
// // on confirm
// })
// .catch(() => {
// //取消刪除
// // on cancel
// })
},
beforeClose(action, done) {
if (action === 'confirm') { //點擊確認
setTimeout(done, 1000)
} else { //點擊取消
done()
}
}
圖片顯示如下: