Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

拉取最新的master代码,然后开启multiTab,控制台抛错:NavigationDuplicated: Avoided redundant navigation to current location #1199

Open
hegphegp opened this issue Jun 17, 2021 · 0 comments

Comments

@hegphegp
Copy link

  • 拉取最新的master代码,然后开启multiTab,控制台抛错:NavigationDuplicated: Avoided redundant navigation to current location
multiTab的配置如下
在 src/layouts/basiclayout.vue里<router-view /> 前添加 <multi-tab v-if="multiTab"></multi-tab>
然后引入组件
import MultiTab from '@/components/MultiTab'

  components: {
    SettingDrawer,
    RightContent,
    GlobalFooter,
    MultiTab//ADD it
  },

..........

  computed: {
    ...mapState({
      // 动态主路由
      mainMenu: (state) => state.permission.addRouters,
      multiTab: (state) => state.app.multiTab  //ADD it
    })
  },

然后在 config/defaultSettings.js加入一行 multiTab: true,
网上很多博客说添加下面代码可以解决这个问题,我发现项目本身就有下面配置,但是控制台还是抛错
//获取原型对象上的push函数
const originalPush = Router.prototype.push
//修改原型对象中的push方法
Router.prototype.push = function push(location) {
   return originalPush.call(this, location).catch(err => err)
}

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant