mirror of
https://github.com/m-xlsea/ruoyi-plus-soybean.git
synced 2025-09-24 07:49:47 +08:00
feat(projects): 迁移多页签
This commit is contained in:
@ -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
23
src/utils/router/tab.ts
Normal 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([]);
|
||||
}
|
Reference in New Issue
Block a user