refactor: refacotr preference

This commit is contained in:
vben
2024-06-01 23:15:29 +08:00
parent f7b97e8a83
commit fed47f5e05
139 changed files with 2205 additions and 1450 deletions

View File

@@ -1,7 +1,8 @@
import type { MenuRecordRaw } from '@vben-core/typings';
import { preference, usePreference } from '@vben/preference';
import { useAccessStore } from '@vben/stores';
import { preferences, usePreferences } from '@vben-core/preferences';
import { useAccessStore } from '@vben-core/stores';
import { computed, onBeforeMount, ref } from 'vue';
import { useRoute } from 'vue-router';
@@ -15,17 +16,18 @@ function useMixedMenu() {
const splitSideMenus = ref<MenuRecordRaw[]>([]);
const rootMenuPath = ref<string>('');
const { isMixedNav } = usePreference();
const { isMixedNav } = usePreferences();
const needSplit = computed(
() => preference.navigationSplit && isMixedNav.value,
() => preferences.navigation.split && isMixedNav.value,
);
const sideVisible = computed(() => {
const enableSidebar = preferences.sidebar.enable;
if (needSplit.value) {
return preference.sideVisible && splitSideMenus.value.length > 0;
return enableSidebar && splitSideMenus.value.length > 0;
}
return preference.sideVisible;
return enableSidebar;
});
const menus = computed(() => accessStore.getAccessMenus);