this.$confirm 源代码方法是基于new Pormise 方法来操作的 方法末尾的catch 是不能删除的,需要存在抛出错误的地方
this.$prompt('请输入分类名称', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputPattern: /^[\s\S]*.*[^\s][\s\S]*$/,
inputErrorMessage: '分类名称不能为空',
inputPlaceholder:'请输入分类名称',
beforeClose:(action, instance, done)=>{
if(action == 'confirm'){
}else{
done();
}
},
},
).catch((e)=>{});//这句不能删
beforeClose 写法(如上)和 then(()=>{}) (如下)写法无影响
this.$prompt('请输入邮箱', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
inputErrorMessage: '邮箱格式不正确'
}).then(({ value }) => {
}).catch(() => {
});
beforeClose写法 有利操作 done(); 手动关闭
当前dialog then(()=>{}) 无法人为关闭dialog 的关闭