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, onReject) { if (onResolve || onReject) return originalPush.call(this, location, onResolve, onReject); return originalPush.call(this, location).catch(err => err); }; //replace VueRouter.prototype.replace = function push(location, onResolve, onReject) { if (onResolve || onReject) return originalReplace.call(this, location, onResolve, onReject); return originalReplace.call(this, location).catch(err => err); };
标签:call,onResolve,location,VueRouter,Error,push,new,navigation,onReject 来源: https://www.cnblogs.com/hong-yf/p/16361784.html