标签:cti 点击事件 class methods === ant export msi pre
浏览器报错内容:
vue-router.esm.js?8c4f:2008 Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location: "/order".
解决方法一:
//在router/index.js最后添加
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)}
解决方法二:
在点击事件跳转时判断一下路径:
<div :class="{active:$route.path===‘/msite‘}" @click="goPath(‘/msite‘)" class="guideItem">
export default {
methods: {
goPath(path){
//跳转到指定的路由路径
if(path!==this.$route.path){//解决页面重复跳转报错问题
this.$router.push(path)
}
},
},
}
标签:cti 点击事件 class methods === ant export msi pre
原文地址:https://www.cnblogs.com/wuwangguilai/p/14147799.html