From 9f8e01053411cb469e00db5059edb2813d7cf5b3 Mon Sep 17 00:00:00 2001 From: vben Date: Thu, 6 Apr 2023 22:17:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E9=87=8D=E6=9E=84=20useRefs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/hooks/src/index.ts | 1 + {src/hooks/core => packages/hooks/src}/useRefs.ts | 0 src/components/Application/src/search/AppSearchModal.vue | 2 +- src/components/Application/src/search/useMenuSearch.ts | 5 +++-- 4 files changed, 5 insertions(+), 3 deletions(-) rename {src/hooks/core => packages/hooks/src}/useRefs.ts (100%) diff --git a/packages/hooks/src/index.ts b/packages/hooks/src/index.ts index 3d546e9c7..2ffa9937f 100644 --- a/packages/hooks/src/index.ts +++ b/packages/hooks/src/index.ts @@ -1,2 +1,3 @@ export * from './onMountedOrActivated'; export * from './useAttrs'; +export * from './useRefs'; diff --git a/src/hooks/core/useRefs.ts b/packages/hooks/src/useRefs.ts similarity index 100% rename from src/hooks/core/useRefs.ts rename to packages/hooks/src/useRefs.ts diff --git a/src/components/Application/src/search/AppSearchModal.vue b/src/components/Application/src/search/AppSearchModal.vue index b37b22613..f50b41933 100644 --- a/src/components/Application/src/search/AppSearchModal.vue +++ b/src/components/Application/src/search/AppSearchModal.vue @@ -64,7 +64,7 @@ import { Icon } from '/@/components/Icon'; import vClickOutside from '/@/directives/clickOutside'; import { useDesign } from '/@/hooks/web/useDesign'; - import { useRefs } from '/@/hooks/core/useRefs'; + import { useRefs } from '@vben/hooks'; import { useMenuSearch } from './useMenuSearch'; import { useI18n } from '/@/hooks/web/useI18n'; import { useAppInject } from '/@/hooks/web/useAppInject'; diff --git a/src/components/Application/src/search/useMenuSearch.ts b/src/components/Application/src/search/useMenuSearch.ts index 9101b4ac9..1b8c71fb5 100644 --- a/src/components/Application/src/search/useMenuSearch.ts +++ b/src/components/Application/src/search/useMenuSearch.ts @@ -1,4 +1,5 @@ -import type { Menu } from '/@/router/types'; +import { type Menu } from '/@/router/types'; +import { type AnyFunction } from '@vben/types'; import { ref, onBeforeMount, unref, Ref, nextTick } from 'vue'; import { getMenus } from '/@/router/menus'; import { cloneDeep } from 'lodash-es'; @@ -26,7 +27,7 @@ function createSearchReg(key: string) { return new RegExp(str); } -export function useMenuSearch(refs: Ref, scrollWrap: Ref, emit: EmitType) { +export function useMenuSearch(refs: Ref, scrollWrap: Ref, emit: AnyFunction) { const searchResult = ref([]); const keyword = ref(''); const activeIndex = ref(-1);