解决报错(Navigation cancelled from “/roleList“ to “/userlist“ with a new navigation.)

写项目的时候,报了一个错,现在总结出来,希望可以帮助到你们。

在这里插入图片描述
这个报错的原因:使用新导航取消了从“/roleList”到“/userlist”的导航。

解决的方法:

关于Vue Router报错

路由跳转报错问题只需要在router中的index.js中写:

import Vue from ‘vue’

import VueRouter from ‘vue-router’

Vue.use(VueRouter)

const originalPush = VueRouter.prototype.push

VueRouter.prototype.push = function push (location) {

return originalPush.call(this, location).catch(err => err)

}

在这里插入图片描述

posted @ 2020-11-10 14:19  醉温柔  阅读(7080)  评论(1编辑  收藏  举报