背景:路由query信息参数存在相同项,导致出现失误,误以为跳转路径相同。
解决:使用promise中catch方法解决
import Router from 'vue-router'
Vue.use(Router)
const originalPush: any = Router.prototype.push
Router.prototype.push = function(location: any) {
return originalPush.call(this, location).catch((err: any) => err)
}