Problems encountered:
路由跳转同一页面,携带不同参数,页面不刷新的问题
Solution:
First of all,
路由配置页面
to make a judgment, you only need to copy the following code directly without any changes
/** 解决跳转重复路由报错问题 */
const routerPush = router.push;
router.push = path => {
// 判断下当前路由是否就是要跳转的路由
if (router.currentRoute.fullPath.includes(path)) return;
return routerPush.call(router, path);
}
Secondly, in
跳转到的页面
your添加监听watch
watch:{
// 解决路由跳转同一个页面,携带不同参数,页面不刷新问题
'$route' (to, from) {
console.log(to)
console.log(from)
// 在此处放置你create里的内容(或者mounted里面的内容)
}
}
The above two steps can solve this problem
Since it's not bad enough to make you cry, why not just laugh out loud Life is short and be happy