admin管理员组

文章数量:1612098

今天在写一个后台界面的时候,出现了这个报错,Navigating to current location ("/userslist") is not allowed问题。 

” 不允许导航到当前位置(“/userslist”)“

在网上查了下,发现问题,大致如下:

原因:当前访问的路由是相同的。

解决办法:需要重写路由的push方法

在【router/index.js路由页面】

import VueRouter from "vue-router";
// 重写路由的push方法
 
const routerPush = Router.prototype.push
Router.prototype.push = function push(location) {
  return routerPush.call(this, location).catch(error=> error)
}

 

本文标签: 路由项目quotMessagevue