在router的index.js里面加入以下代码
const originalPush = Router.prototype.push
Router.prototype.push = function(location) {
return originalPush.call(this, location).catch(err => err)
}
注意Router名,与import Router from 'vue-router’引入的名保持一致
在router的index.js里面加入以下代码
const originalPush = Router.prototype.push
Router.prototype.push = function(location) {
return originalPush.call(this, location).catch(err => err)
}
注意Router名,与import Router from 'vue-router’引入的名保持一致