我是靠谱客的博主 鳗鱼月光,这篇文章主要介绍ant-design-vue中this.$confirm 确认框使用,现在分享给大家,希望可以做个参考。

cancelService (obj) {
let self = this
this.$confirm({
title: '确认提示',
content: `是否确认取消服务?`,
okType: 'danger',
onOk () {
return new Promise((resolve, reject) => {
let data = {
"apply_id": self.dataArea.apply_id
}
api.cancelServer(data).then(res => {
if (res.status === 0) {
self.$message.success("服务取消成功! ")
self.auditForm.resetFields()
self.formModal = false
self.$emit("on-update")
} else {
self.$message.error("服务取消失败:" + res.data)
}
}).catch((e) => {
self.$message.error("服务取消失败")
}).finally(() => {
resolve()
})
})
}
})
}

确认框中用到的当前作用域this需要提前替换为局部变量,否则浏览器会提示无法获取该属性。最后的finally中需要调用Promise的参数方法resolve(),用于程序继续向下执行,否则会出现假死。

最后

以上就是鳗鱼月光最近收集整理的关于ant-design-vue中this.$confirm 确认框使用的全部内容,更多相关ant-design-vue中this.$confirm内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(52)

评论列表共有 0 条评论

立即
投稿
返回
顶部