编程式导航跳转到当前路由(参数不变),多次执行就会在控制台出现如下结果:
怎么解决:
(1)最有效——重写push、replace
在router-index.js中添加:
// 重写push、replace方法
// 先把VueRouter原型对象上的Push/Replace保存一份
let originPush = VueRouter.prototype.push
let originReplace = VueRouter.prototype.replace
// 重写push、replace方法
VueRouter.prototype.push = function (location, resolve, reject) {
if