😎修复用户菜单为空时无限刷新接口的问题
This commit is contained in:
parent
41b8b361cd
commit
381724ab81
@ -10,6 +10,7 @@ import { Session, Local } from '/@/utils/storage';
|
|||||||
import { staticRoutes, notFoundAndNoPower } from '/@/router/route';
|
import { staticRoutes, notFoundAndNoPower } from '/@/router/route';
|
||||||
import { initFrontEndControlRoutes } from '/@/router/frontEnd';
|
import { initFrontEndControlRoutes } from '/@/router/frontEnd';
|
||||||
import { initBackEndControlRoutes } from '/@/router/backEnd';
|
import { initBackEndControlRoutes } from '/@/router/backEnd';
|
||||||
|
import { clearTokens } from '/@/utils/axios-utils';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 1、前端控制路由时:isRequestRoutes 为 false,需要写 roles,需要走 setFilterRoute 方法。
|
* 1、前端控制路由时:isRequestRoutes 为 false,需要写 roles,需要走 setFilterRoute 方法。
|
||||||
@ -120,7 +121,8 @@ router.beforeEach(async (to, from, next) => {
|
|||||||
if (routesList.value.length === 0) {
|
if (routesList.value.length === 0) {
|
||||||
if (isRequestRoutes) {
|
if (isRequestRoutes) {
|
||||||
// 后端控制路由:路由数据初始化,防止刷新时丢失
|
// 后端控制路由:路由数据初始化,防止刷新时丢失
|
||||||
await initBackEndControlRoutes();
|
const isNoPower = await initBackEndControlRoutes();
|
||||||
|
if (isNoPower) clearTokens();
|
||||||
// 解决刷新时,一直跳 404 页面问题,关联问题 No match found for location with path 'xxx'
|
// 解决刷新时,一直跳 404 页面问题,关联问题 No match found for location with path 'xxx'
|
||||||
// to.query 防止页面刷新时,普通路由带参数时,参数丢失。动态路由(xxx/:id/:name")isDynamic 无需处理
|
// to.query 防止页面刷新时,普通路由带参数时,参数丢失。动态路由(xxx/:id/:name")isDynamic 无需处理
|
||||||
next({ path: to.path, query: to.query });
|
next({ path: to.path, query: to.query });
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user