ElementUI中MessageBox弹窗回调函数的用法


最近公司网站有个需求,需要一个弹出框提示。

选用了MessageBox,发现官方文档并没有回调的说明,自己类推了一下,在then里面回调了,action分别为confirm(确认),cancel(取消),close(关闭)的时候分别触发回调。

 

 1 upRisk(){
 2             if(this.userInfo.status==1){
 3                 this.fullscreenLoading = false,
 4                 this.$confirm('您的风险测评已经超过一年, 点击确定重新测评?', '提示', {
 5                   confirmButtonText: '确定',
 6                   cancelButtonText: '取消',
 7                   type: 'warning',
 8                   center: true
 9                 }).then((action) => {
10                         if(action === 'confirm'){
11                             this.$router.replace({path:'/account/risk_test'})
12                         }
13                 }).catch(() => {
14                   this.$message({
15                     type: 'info',
16                     message: '已取消重新测评'
17                   });
18                 });
19             }
20 
21         },

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM