feat(projects): 添加生产的主题配置缓存

This commit is contained in:
Soybean
2022-06-20 23:23:55 +08:00
parent 5c1b086cb4
commit 718c36263e
16 changed files with 137 additions and 48 deletions

View File

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

View File

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