mirror of
https://gitee.com/yiming_chang/vue-pure-admin.git
synced 2024-12-02 11:17:39 +08:00
feat: update
This commit is contained in:
parent
f921996563
commit
a28eb4b203
@ -28,30 +28,35 @@ import setting from "./components/setting/index.vue";
|
|||||||
import Vertical from "./components/sidebar/vertical.vue";
|
import Vertical from "./components/sidebar/vertical.vue";
|
||||||
import Horizontal from "./components/sidebar/horizontal.vue";
|
import Horizontal from "./components/sidebar/horizontal.vue";
|
||||||
|
|
||||||
|
const instance = getCurrentInstance().appContext.app.config.globalProperties;
|
||||||
|
const hiddenSideBar = ref(instance.$config?.HiddenSideBar);
|
||||||
const pureSetting = useSettingStoreHook();
|
const pureSetting = useSettingStoreHook();
|
||||||
|
|
||||||
const instance =
|
// 清空缓存后从serverConfig.json读取默认配置并赋值到storage中
|
||||||
getCurrentInstance().appContext.app.config.globalProperties.$storage;
|
|
||||||
|
|
||||||
const hiddenSideBar = ref(
|
|
||||||
getCurrentInstance().appContext.config.globalProperties.$config?.HiddenSideBar
|
|
||||||
);
|
|
||||||
|
|
||||||
const layout = computed(() => {
|
const layout = computed(() => {
|
||||||
if (!instance.layout) {
|
// 路由
|
||||||
|
if (
|
||||||
|
!instance.$storage.routesInStorage ||
|
||||||
|
instance.$storage.routesInStorage.length === 0
|
||||||
|
) {
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
instance.layout = { layout: "vertical-dark" };
|
instance.$storage.routesInStorage = routerArrays;
|
||||||
}
|
}
|
||||||
if (!instance.routesInStorage || instance.routesInStorage.length === 0) {
|
// 国际化
|
||||||
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
if (!instance.$storage.locale) {
|
||||||
instance.routesInStorage = routerArrays;
|
|
||||||
}
|
|
||||||
if (!instance.locale) {
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
instance.locale = { locale: "zh" };
|
instance.$storage.locale = { locale: instance.$config?.Locale ?? "zh" };
|
||||||
useI18n().locale.value = "zh";
|
useI18n().locale.value = instance.$config?.Locale ?? "zh";
|
||||||
}
|
}
|
||||||
return instance?.layout.layout;
|
// 导航
|
||||||
|
if (!instance.$storage.layout) {
|
||||||
|
// eslint-disable-next-line vue/no-side-effects-in-computed-properties
|
||||||
|
instance.$storage.layout = {
|
||||||
|
layout: instance.$config?.Layout ?? "vertical",
|
||||||
|
theme: instance.$config?.Theme ?? "default"
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return instance.$storage?.layout.layout;
|
||||||
});
|
});
|
||||||
|
|
||||||
const set: setType = reactive({
|
const set: setType = reactive({
|
||||||
@ -83,7 +88,7 @@ const handleClickOutside = (params: boolean) => {
|
|||||||
|
|
||||||
function setTheme(layoutModel: string) {
|
function setTheme(layoutModel: string) {
|
||||||
window.document.body.setAttribute("layout", layoutModel);
|
window.document.body.setAttribute("layout", layoutModel);
|
||||||
instance.layout = { layout: `${layoutModel}` };
|
instance.$storage.layout = { layout: `${layoutModel}` };
|
||||||
}
|
}
|
||||||
|
|
||||||
// 监听容器
|
// 监听容器
|
||||||
|
Loading…
Reference in New Issue
Block a user