Vue configuration routing error

Configured to jump by clicking when jumping

 

 This wrong

Solution one: After many attempts to find out that the reason may be that the vue-router installed is still the version that was in error before downloading the dependent package again,

                      The solution is also very simple, just run npm i [email protected] -S in the project directory.

Solution two: If you do n’t want to use method one, add a piece of code in main.js.

 

code show as below:

import Router from 'vue-router'
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

Guess you like

Origin www.cnblogs.com/fgwh-y/p/12682509.html