1. 简单实用
this.$confirm('这里是confirm提示的确认文案', '这里是title', {
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass:'custom-model',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
2. 自定义使用
const h = this.$createElement
this.$confirm('', {
message:h('div',null, [
h('i',{ class:'el-icon-question',style:'color:#f90;font-size:30px;' }),
h('span',{ style:'margin-left:10px;font-size:16px;line-height:30px;font-weight:600;vertical-align:top;'}, '提示'),
h('p',{ style:'margin:10px 0 0 40px;' },'此操作将永久删除该文件, 是否继续?')
]),
confirmButtonText: '确定',
cancelButtonText: '取消',
customClass:'del-model',
closeOnClickModal:false,
closeOnPressEscape:false,
})
.then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
})
.catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});