最近公司網站有個需求,需要一個彈出框提示。
選用了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 },