element-ui 弹窗的 this.$confirm 框报错 Uncaught (in promise) cancel
这是因为你点击了取消或者是关闭弹窗,但是你没有写 catch。
正确的写法是
| this.$confirm('确定清空试题篮所有试题?', '提示', { | |
| type: 'warning' | |
| }).then(() => { | |
| localStorage.setItem('chosedResourceids',""); | |
| localStorage.setItem('PaperMsg',""); | |
| if( sessionStorage.getItem('PaperMsg')==''){ | |
| this.$message({ | |
| message: '操作成功', | |
| type: 'success' | |
| }); | |
| this.$router.push({name:'资源中心',query:{kind:40}}) | |
|                       } | |
| }).catch(() => { | |
| }); // 一定别忘了这个 | 
