项目中总会遇到需要二次确认的操作,这样可以直接使用element-ui的$confirm实现该功能!
open() {
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
});
});
},
本文介绍如何在项目开发中利用Element-UI库的$confirm组件进行操作确认,通过简单的API实现警告提示,确保关键任务的正确执行与用户交互的友好性。
1441

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



