Tag Archives: Vue route Duplicate Error

[Solved] Vue route Duplicate Error: error avoid redundant navigation to current location: “/home”

Add in index.js under router file

import Vue from 'vue';

import VueRouter from 'vue-router';

Vue.use(VueRouter);

// Solve the problem that vue-router in the navigation bar of ElementUI reports an error when repeatedly clicking the menu in version 3.0 or above
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

perhaps

const originalReplace = VueRouter.prototype.replace;
Router.prototype.replace = function replace(location) {
  return originalReplace.call(this, location).catch(err => err);
};