解决相同路由跳转时,报错
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
if(typeof(location)=="string"){
var Separator = "&";
if(location.indexOf('?')==-1) { Separator='?'; }
location = location + Separator + "random=" + Math.random();
}
return routerPush.call(this, location).catch(error=> error)
}
本文探讨了如何通过在路由跳转时添加随机参数来解决相同路由URL重复导致的错误问题,提供了一个修改后的Router.prototype.push方法实现和解决思路。
507

被折叠的 条评论
为什么被折叠?



