Vue 2.x
Vue 3.x
一个 Vue 3 UI 框架 | Element Plus (gitee.io)
alert 和 this.$alert
// alert('这是 js 自带的提示框')
alert('这是js自带的提示框')
//this.$alert 这是ElementUI提供的提示框 可以带回调函数
this.$alert('这是ElementUI提供的提示框',{
confirmButtonText:'确定',
callback:action => {
this.$message('点击了确定')
}
})
alert
this.$alert
点击完后有回调函数
confirm 和 this.$confirm
//这是 js 自带的确认框,不需要Vue+ElementUI 环境也能使用
confirm('是否删除')
this.$confirm需要Vue+ElementUI 环境才能使用
this.$confirm('此操作将永久删除该文件, 是否继续?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$message({
type: 'success',
message: '删除成功!'
});
}).catch(() => {
this.$message({
type: 'info',
message: '已取消删除'
}