Skip to content

Commit

Permalink
fix(route): the whitelist should include basicRoutes (#1048)
Browse files Browse the repository at this point in the history
* fix(table): recursive updateTableDataRecord

无刷新更新表格数据时,支持递归查找,用于树状数据时。同时新增 findTableDataRecord 函数,用于支持无刷新新增数据到树状表格中

* fix(router): whitelist include basicRoutes

白名单应包含不在菜单上出现的静态路由,否则在动态切换菜单 resetRouter 时会丢失这些,如在usePermission.resume中

* fix: get basicRoutes whitelist bad code
  • Loading branch information
leocaan authored Aug 8, 2021
1 parent 62f8468 commit 1bb5156
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,16 @@ import type { RouteRecordRaw } from 'vue-router';
import type { App } from 'vue';

import { createRouter, createWebHashHistory } from 'vue-router';
import { basicRoutes, LoginRoute } from './routes';
import { REDIRECT_NAME } from './constant';
import { basicRoutes } from './routes';

const WHITE_NAME_LIST = [LoginRoute.name, REDIRECT_NAME];
// 白名单应该包含基本静态路由
const WHITE_NAME_LIST: string[] = [];
const getRouteNames = (array: any[]) =>
array.forEach((item) => {
WHITE_NAME_LIST.push(item.name);
getRouteNames(item.children || []);
});
getRouteNames(basicRoutes);

// app router
export const router = createRouter({
Expand Down

0 comments on commit 1bb5156

Please sign in to comment.