在项目开发中,遇到了一个需求,就是在Message弹框,在按钮上方添加一行文字
如图:
this.$confirm('<span>此操作将永久删除该文件, 是否继续?</span><p style="color:red;">删除后消失</p>', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
dangerouslyUseHTMLString: true,
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
在this.$confirm
后的第一个参数添加span、p标签,还可以添加样式