From 5f0e91c5ec1edcd6909b0a1991ededee3f3dbee6 Mon Sep 17 00:00:00 2001 From: ClariS <1457715339@qq.com> Date: Mon, 14 Aug 2023 17:08:44 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E5=AF=B9=E6=90=9C=E7=B4=A2=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E7=BB=84=E4=BB=B6=E8=BF=9B=E8=A1=8C=E4=BC=98=E5=8C=96?= =?UTF-8?q?=20(#106)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/SearchMenu/SearchFooter.vue | 4 +--- src/components/SearchMenu/SearchModal.vue | 8 ++++++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/components/SearchMenu/SearchFooter.vue b/src/components/SearchMenu/SearchFooter.vue index 80031de..b30cfd5 100644 --- a/src/components/SearchMenu/SearchFooter.vue +++ b/src/components/SearchMenu/SearchFooter.vue @@ -7,9 +7,7 @@ interface Props { total: number } -const props = withDefaults(defineProps(), { - total: 0 -}) +const props = defineProps() const appStore = useAppStore() const isMobile = computed(() => appStore.device === DeviceEnum.Mobile) diff --git a/src/components/SearchMenu/SearchModal.vue b/src/components/SearchMenu/SearchModal.vue index 1fc4c4b..f7db586 100644 --- a/src/components/SearchMenu/SearchModal.vue +++ b/src/components/SearchMenu/SearchModal.vue @@ -5,7 +5,7 @@ import { useAppStore } from "@/store/modules/app" import { usePermissionStore } from "@/store/modules/permission" import SearchResult from "./SearchResult.vue" import SearchFooter from "./SearchFooter.vue" -import { ElScrollbar } from "element-plus" +import { ElMessage, ElScrollbar } from "element-plus" import { cloneDeep, debounce } from "lodash-es" import { DeviceEnum } from "@/constants/app-key" @@ -119,7 +119,11 @@ const handleDown = () => { /** 键盘回车键 */ const handleEnter = () => { const { length } = resultList.value - if (length === 0 || !activeRouteName.value) return + if (length === 0) return + if (!activeRouteName.value) { + ElMessage.error("无法通过搜索功能进入该菜单,请为对应的路由设置唯一的 Name") + return + } router.push({ name: activeRouteName.value }) handleClose() }