From 88f4a3f02a0c0f35953c93427fe700d414b6ec50 Mon Sep 17 00:00:00 2001 From: vben Date: Mon, 7 Dec 2020 22:18:57 +0800 Subject: [PATCH] perf: perf menu --- .../Application/src/AppLocalePicker.vue | 21 +- src/components/Basic/src/BasicArrow.vue | 8 +- src/components/Menu/src/BasicMenu.tsx | 278 +++++++++--------- src/components/Menu/src/BasicMenu.vue | 11 - src/components/Menu/src/MenuContent.tsx | 55 ++-- src/components/Menu/src/index.less | 247 ++++++++-------- src/components/Menu/src/props.ts | 16 +- src/components/Menu/src/useOpenKeys.ts | 23 +- src/hooks/setting/useHeaderSetting.ts | 138 ++++----- src/hooks/setting/useLocaleSetting.ts | 38 +-- src/hooks/setting/useMenuSetting.ts | 164 +++++------ src/hooks/setting/useMultipleTabSetting.ts | 20 +- src/hooks/setting/useRootSetting.ts | 81 ++--- src/hooks/setting/useTransitionSetting.ts | 32 +- src/hooks/web/useDesign.ts | 17 +- src/hooks/web/useFullContent.ts | 4 +- src/hooks/web/usePage.ts | 2 - src/layouts/default/header/LayoutHeader.tsx | 10 +- .../default/header/LayoutMultipleHeader.tsx | 5 +- src/layouts/default/menu/index.tsx | 45 +-- src/layouts/default/menu/useLayoutMenu.ts | 43 +-- src/layouts/default/sider/index.less | 23 +- src/layouts/default/sider/index.tsx | 4 +- src/utils/is.ts | 5 + 24 files changed, 634 insertions(+), 656 deletions(-) delete mode 100644 src/components/Menu/src/BasicMenu.vue diff --git a/src/components/Application/src/AppLocalePicker.vue b/src/components/Application/src/AppLocalePicker.vue index 3ea924f1..72c4c7f9 100644 --- a/src/components/Application/src/AppLocalePicker.vue +++ b/src/components/Application/src/AppLocalePicker.vue @@ -8,10 +8,10 @@ :dropMenuList="localeList" :selectedKeys="selectedKeys" @menuEvent="handleMenuEvent" - overlayClassName="app-locale-picker-overlay" + :overlayClassName="`${prefixCls}-overlay`" > - - + + {{ getLangText }} @@ -28,6 +28,7 @@ import { LocaleType } from '/@/locales/types'; import { propTypes } from '/@/utils/propTypes'; + import { useDesign } from '/@/hooks/web/useDesign'; export default defineComponent({ name: 'AppLocalPicker', @@ -39,9 +40,12 @@ reload: propTypes.bool, }, setup(props) { - const { localeList } = useLocaleSetting(); const selectedKeys = ref([]); + const { prefixCls } = useDesign('app-locale-picker'); + + const { localeList } = useLocaleSetting(); + const { changeLocale, getLang } = useLocale(); const getLangText = computed(() => { @@ -64,19 +68,22 @@ toggleLocale(menu.event as string); } - return { localeList, handleMenuEvent, selectedKeys, getLangText }; + return { localeList, handleMenuEvent, selectedKeys, getLangText, prefixCls }; }, });