Files
wireguard-dashboard-admin/src/utils/storage/responsive.ts

61 lines
1.7 KiB
TypeScript
Raw Normal View History

2021-10-16 16:16:58 +08:00
// 响应式storage
import { App } from "vue";
import Storage from "responsive-storage";
export const injectResponsiveStorage = (app: App, config: ServerConfigs) => {
2021-11-28 16:39:26 +08:00
const configObj = Object.assign(
{
// 国际化 默认中文zh
locale: {
type: Object,
default: Storage.getData(undefined, "locale") ?? {
locale: config.Locale ?? "zh"
}
},
// layout模式以及主题
layout: {
type: Object,
default: Storage.getData(undefined, "layout") ?? {
layout: config.Layout ?? "vertical",
2021-12-22 10:12:52 +08:00
theme: config.Theme ?? "default",
2022-01-05 14:17:06 +08:00
darkMode: config.DarkMode ?? false,
sidebarStatus: config.SidebarStatus ?? true,
epThemeColor: config.EpThemeColor ?? "409EFF"
2021-11-28 16:39:26 +08:00
}
},
2022-01-05 14:17:06 +08:00
configure: {
2021-11-28 16:39:26 +08:00
type: Object,
2022-01-05 14:17:06 +08:00
default: Storage.getData(undefined, "configure") ?? {
2021-11-28 16:39:26 +08:00
grey: config.Grey ?? false,
weak: config.Weak ?? false,
2021-12-08 11:22:03 +08:00
hideTabs: config.HideTabs ?? false,
2022-01-05 14:17:06 +08:00
showLogo: config.ShowLogo ?? true,
showModel: config.ShowModel ?? "smart",
2021-12-08 11:22:03 +08:00
multiTagsCache: config.MultiTagsCache ?? false
2021-10-16 16:16:58 +08:00
}
}
},
2021-11-28 16:39:26 +08:00
config.MultiTagsCache
? {
// 默认显示首页tag
tags: {
type: Array,
default: Storage.getData(undefined, "tags") ?? [
{
path: "/welcome",
parentPath: "/",
meta: {
2022-01-05 14:17:06 +08:00
title: "menus.hshome",
2021-11-28 16:39:26 +08:00
i18n: true,
2022-02-05 14:45:20 +08:00
icon: "home-filled"
2021-11-28 16:39:26 +08:00
}
}
]
}
}
: {}
);
app.use(Storage, configObj);
2021-10-16 16:16:58 +08:00
};