您的位置:首页 > 产品设计 > UI/UE

elment-ui中的$prompt,阻止点击确定关闭弹窗

2019-08-15 16:47 2967 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。 本文链接:https://blog.csdn.net/weixin_45152848/article/details/99643126
this.$prompt('请输入新名称', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputErrorMessage: '输入不能为空',
inputValidator: (value)=>{
if(value.trim().length < 1){
return '输入不能为空'
}
},
beforeClose: (action, instance, done)=>{
if(action == 'confirm'){
let value = instance.inputValue
if(value && value != ''){
new Promise((resolve,reject)=>{
....
}).then((res)=>{
if('成功){
this.$Notice.success({
desc: '成功',
duration: 2
})
done()
}else{
this.$notify({
type: 'error',
message: '报错信息',
duration: 2000
})
$(instance.$el).find('input').focus()
}
})
}else{
this.$notify({
type: 'error',
message: '请输入名称',
duration: 2000
})
}
}else{
done()
}
}
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: