mirror of
https://github.com/pure-admin/pure-admin-thin.git
synced 2025-04-24 23:47:17 +08:00
38 lines
1.2 KiB
TypeScript
38 lines
1.2 KiB
TypeScript
// 响应式storage
|
|
import { App } from "vue";
|
|
import Storage from "responsive-storage";
|
|
import { routerArrays } from "@/layout/types";
|
|
|
|
const nameSpace = "responsive-";
|
|
|
|
export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
|
|
const configObj = Object.assign(
|
|
{
|
|
// layout模式以及主题
|
|
layout: Storage.getData("layout", nameSpace) ?? {
|
|
layout: config.Layout ?? "vertical",
|
|
theme: config.Theme ?? "default",
|
|
darkMode: config.DarkMode ?? false,
|
|
sidebarStatus: config.SidebarStatus ?? true,
|
|
epThemeColor: config.EpThemeColor ?? "#409EFF"
|
|
},
|
|
configure: Storage.getData("configure", nameSpace) ?? {
|
|
grey: config.Grey ?? false,
|
|
weak: config.Weak ?? false,
|
|
hideTabs: config.HideTabs ?? false,
|
|
showLogo: config.ShowLogo ?? true,
|
|
showModel: config.ShowModel ?? "smart",
|
|
multiTagsCache: config.MultiTagsCache ?? false
|
|
}
|
|
},
|
|
config.MultiTagsCache
|
|
? {
|
|
// 默认显示首页tag
|
|
tags: Storage.getData("tags", nameSpace) ?? routerArrays
|
|
}
|
|
: {}
|
|
);
|
|
|
|
app.use(Storage, { nameSpace, memory: configObj });
|
|
};
|