首页 > TAG信息列表 > onReject

解决 Vue-Router 升级导致的 Uncaught (in promise) 问题

解决 Vue-Router 升级导致的 Uncaught (in promise) 问题 在 Vue-Router 升级到 3.1.0 之后,push 和 replace 方法会返回一个 promise,你可能在控制台看到未捕获的异常。这只是编程式导航才会出现的问题 此前版本没有报错的原因是 vue-router 没有返回错误信息,所以我们一直无法捕获,

Uncaught (in promise) Error: Navigation cancelled from "/" to "/home" with a new

vue报了以下报错:   原因:未知,能解决就行(。。。。)   在router的index.js中插入以下代码解决: const originalPush = VueRouter.prototype.push; const originalReplace = VueRouter.prototype.replace; //push VueRouter.prototype.push = function push(location, onResolve, on

探究vue-router重复路由跳转问题

有时候你在vue项目中做路由跳转时,可能是比如elementUI的memn同级跳转,也可能是比如root.vue中做身份校验跳转,总之,可能会遇到这样的报错: Uncaught (in promise) NavigationDuplicated:... 你说他难看吧,也确实难看。但要说是个错误吧,也不影响正常逻辑。但是有错误还是要解决的

vueRouter push方法重写

// vue相同路由跳转报错问题处理 const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location, onResolve, onReject) { if(onResolve || onReject) return originalPush.call(this, location, onResolve, onReject) return originalPush

vue 导航守卫 router 高版本报错

重写 push 事件   import VueRouter from 'vue-router'  const originalPush = VueRouter.prototype.push VueRouter.prototype.push = function push(location, onResolve, onReject) { if (onResolve || onReject) return originalPush.call(this, locat