今天使用vue-cli脚手架,当使用路由的时候,突然报了下面这个错误,不知道是怎么回事,然后查了一下,
解决方法是:
在router目录下的index.js文件中加入如下语句:
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
今天使用vue-cli脚手架,当使用路由的时候,突然报了下面这个错误,不知道是怎么回事,然后查了一下,
解决方法是:
在router目录下的index.js文件中加入如下语句:
const originalPush = Router.prototype.push
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}