type 消息类型,用于显示图标 success / info / warning / error
1、消息提示
this.$alert('这是一段内容', '标题名称', {
confirmButtonText: '确定',
callback: action => {
this.$message({
type: 'success',
message: '普通的提示消息'
});
}
});


2、确认消息
this.$confirm('此操作将禁用该充值包, 是否继续?禁用后用户仍可正常充值此充值包', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '禁用成功!'
})
// 发送接口请求
}).catch(() => console.log('取消'))

本文展示了在Vue.js应用中如何使用$alert和$confirm进行消息提示和确认操作。例如,通过$alert显示普通提示,并在回调中设置success类型的消息。同时,利用$confirm展示警告对话框,确认后发送接口请求并显示成功信息。

1356

被折叠的 条评论
为什么被折叠?



