feat(projects): 迁移多页签

This commit is contained in:
Soybean
2022-01-20 00:56:59 +08:00
parent cc290accc2
commit 28efbdbc70
26 changed files with 868 additions and 20 deletions

View File

@ -1,4 +1,5 @@
export * from './helpers';
export * from './menu';
export * from './breadcrumb';
export * from './tab';
export * from './regexp';

23
src/utils/router/tab.ts Normal file
View File

@ -0,0 +1,23 @@
import { EnumStorageKey } from '@/enum';
import type { GlobalTabRoute } from '@/interface';
import { setLocal, getLocal } from '../storage';
/** 缓存多页签数据 */
export function setTabRoutes(data: GlobalTabRoute[]) {
setLocal(EnumStorageKey['tab-routes'], data);
}
/** 获取缓存的多页签数据 */
export function getTabRoutes() {
const routes: GlobalTabRoute[] = [];
const data = getLocal<GlobalTabRoute[]>(EnumStorageKey['tab-routes']);
if (data) {
routes.push(...data);
}
return routes;
}
/** 清空多页签数据 */
export function clearTabRoutes() {
setTabRoutes([]);
}