NavigationDuplicated报错问题

  • Post author:
  • Post category:其他




问题:

跳转至当前路由时报错:

Uncaught (in promise) NavigationDuplicated: Avoided redundant navigation to current location

在这里插入图片描述



解决:

import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)

// 解决NavigationDuplicated报错问题
const originalPush = Router.prototype.push
Router.prototype.push = function push (location) {
  return originalPush.call(this, location).catch(err => err)
}



版权声明:本文为denghuocc原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。