Confirm
返回Promise
配置项
param | type | default | desc |
---|---|---|---|
title | string | '提示' | |
message | string | '' | |
okText | string | '确定' | |
cancelText | string | '取消' | |
html | string | '' | 可以传入html片段 如若传入,将替换掉message内容 |
wait | function | null | 支持异步式调用 传入next参数 并在函数体中调用next()即可实现异步式调用 效果与alert wait 类似 但是一旦进入加载状态 将隐藏取消按钮 点击确认才会调用wait |
基础用法
await this.$dialog.confirm({
title: '提示',
message: '请登陆后再试',
okText: '去登陆'
})
// do someting...
异步关闭用法
async () => {
await dialogX.confirm({
message: '点击确认后购买',
wait: async next => {
await fetch('xxx')
next()
}
})
dialogX.alert({message: '购买成功'})
}