1***@qq.com
1***@qq.com
  • 发布:2023-02-27 11:01
  • 更新:2023-02-27 11:01
  • 阅读:118

使用动态路由时,必须要注意的

分类:uni-app

写在router文件下的index.js 下:

// 避免路由重复报错 NavigationDuplicated: Avoided redundant navigation to current location: "//".
const originalPush = Router.prototype.push;
const originalReplace = Router.prototype.replace;
Router.prototype.push = function push(location) {
return originalPush.call(this, location).catch(err => err)
}
Router.prototype.replace = function replace(location) {
return originalReplace.call(this, location).catch(err => err);
};

0 关注 分享

要回复文章请先登录注册