Daily work sharing: Today there is a need to perform some button operations when leaving this page, but the jump routes are all packaged uniformly
Implementation method: Use route interception to perform interception operations. For example, when I leave this page, there are a series of operations that need to be performed. At this time, I can use route interception beforeRouteLeave
/*路由拦截*/
beforeRouteLeave (to, from, next) {
//to去往哪里
//from当前路由
在做完一系列操作后放行,需要使用next(),代表可以下一步
this.$confirm('是否需要保存修改?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.Submit()
next()
setTimeout(() => {
this.$router.push(to.path)
},500)
}).catch(() => {
next()
setTimeout(() => {
this.$router.push(to.path)
},500)
});
},
Daily sharing of other work:
The unified input box can only input numbers and cannot be less than 1.
Use loops to always get the final value.
Use
el-form to dynamically control whether rules are checked.
Vue implements only positive and negative reviews.
Hungry? UI custom header content