![cover](https://img-blog.csdnimg.cn/img_convert/a7b426f027554ddcbce196b962043da2.png)
【vue】this.$alert、this.$confirm的简单使用
【vue】this.$alert、this.$confirm的简单使用
![](https://csdnimg.cn/release/devpress/public/img/ic-book.4f347164.png)
一键AI生成摘要,助你高效阅读
问答
·
一、this.$alert
参数:
1. 提示框的内容
2. 提示框的标题
3. confirmButtonText是按钮的名称
4. 点击确定后的回调函数
this.$alert(res.msg, "温馨提示", {
confirmButtonText: "确定",
callback: action => {
this.$router.go(0);
}
});
二、this.$confirm
参数:
1. 提示框的内容
2. 提示框的标题
3. confirmButtonText是确认按钮的名称
4. cancelButtonText是取消按钮的名称
5. type是消息类型,可以为success
,error
,info
和warning
this.$confirm(res.data, '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning',
showCancelButton: false, //是否显示取消按钮
showClose: false, //是否显示右上角的x
closeOnClickModal: true, //是否可以点击空白处关闭弹窗
})
.then(() => {
// this.$message({
// type: 'success',
// message: '删除成功!'
// });
})
.catch(() => {
// this.$message({
// type: 'info',
// message: '已取消删除'
// });
});
更多推荐
所有评论(0)