NavigationDuplicated {_name: "NavigationDuplicated", name: "NavigationDuplicated", message: "Navigating to current location ("/produce/delivery-order") is not allowed", stack: "Error↵    at new NavigationDuplicated (webpack-int…_modules/_vue@2.6.10@vue/dist/vue.esm.js:1862:26)"}

解决方法:
在router.js中加入以下代码就可以

const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

方法二

    created() {
        const defaultHref = this.menuList[0].children ? this.defaultActive(this.menuList[0].children) : this.menuList[0]
        if (this.$route.path !== defaultHref.href) {
            this.$router.replace({
                path: defaultHref.href
            })
        }
    },

Logo

前往低代码交流专区

更多推荐