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()
}
}
})
elment-ui中的$prompt,阻止点击确定关闭弹窗
最新推荐文章于 2023-08-08 13:10:04 发布