This theme is |

guangzan

园龄:6年5个月粉丝:676关注:333

2020-03-27 03:51阅读: 397评论: 0推荐: 0

vue router Uncaught (in promise)

原因: 没有使用catch捕获方法

解决方法: 重写 Router 原型链上的 push、replace 方法

import Router from 'vue-router'

const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject)
  return originalPush.call(this, location).catch(err => err)
}

本文作者:guangzan

本文链接:https://www.cnblogs.com/guangzan/p/12244563.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   guangzan  阅读(397)  评论(0编辑  收藏  举报
评论
收藏
关注
推荐
深色
回顶
收起
点击右上角即可分享
微信分享提示