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 } from '@vben/preference';
import { useAccessStore } from '@vben/stores';
import { preferences } from '@vben-core/preferences';
import { useAccessStore } from '@vben-core/stores';
import { computed, ref } from 'vue';
import { useRoute } from 'vue-router';
@@ -46,7 +47,7 @@ function useExtraMenu() {
extraMenus.value = rootMenu?.children ?? [];
extraActiveMenu.value = menu.parents?.[0] ?? menu.path;
if (preference.sideExpandOnHover) {
if (preferences.sidebar.expandOnHover) {
extraVisible.value = extraMenus.value.length > 0;
}
};
@@ -55,7 +56,7 @@ function useExtraMenu() {
* 侧边菜单鼠标移出事件
*/
const handleSideMouseLeave = () => {
if (preference.sideExpandOnHover) {
if (preferences.sidebar.expandOnHover) {
return;
}
extraVisible.value = false;
@@ -69,7 +70,7 @@ function useExtraMenu() {
};
const handleMenuMouseEnter = (menu: MenuRecordRaw) => {
if (!preference.sideExpandOnHover) {
if (!preferences.sidebar.expandOnHover) {
const { findMenu } = findRootMenuByPath(menus.value, menu.path);
extraMenus.value = findMenu?.children ?? [];
extraActiveMenu.value = menu.parents?.[0] ?? menu.path;