Error: Avoided redundant navigation to current location: “/home“

created at 01-30-2022 views: 15

problem

In VUE, the route encounters Error: Avoided redundant navigation to current location and the error shows that the route is duplicated

solution

When introducing router, add

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

location the code is added: router.js

created at:01-30-2022
edited at: 01-30-2022: