From b4183f59a96d8dee439ae91992d7f8707778994b Mon Sep 17 00:00:00 2001
From: ray <1490493387@qq.com>
Date: Wed, 30 Oct 2024 08:07:44 +0800
Subject: [PATCH] =?UTF-8?q?refactor:=20:recycle:=20=E8=8F=9C=E5=8D=95?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E7=A7=BB=E9=99=A4=E5=8E=86=E5=8F=B2=E8=AE=B0?=
=?UTF-8?q?=E5=BD=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/MenuSearch/index.vue | 20 ++++----------------
1 file changed, 4 insertions(+), 16 deletions(-)
diff --git a/src/components/MenuSearch/index.vue b/src/components/MenuSearch/index.vue
index 49a093fa..5491b5c3 100644
--- a/src/components/MenuSearch/index.vue
+++ b/src/components/MenuSearch/index.vue
@@ -43,7 +43,7 @@
{{ item.title }}
-
暂无历史记录
+
@@ -76,7 +76,6 @@ const searchInputRef = ref();
const excludedRoutes = ref(["/redirect", "/login", "/401", "/404"]);
const menuItems = ref([]);
const searchResults = ref([]);
-const searchHistory = ref([]);
const activeIndex = ref(-1);
interface SearchItem {
@@ -115,12 +114,8 @@ function updateSearchResults() {
}
}
-// 显示搜索结果或历史记录
-const displayResults = computed(() => {
- return searchResults.value.length > 0
- ? searchResults.value
- : searchHistory.value.slice(0, 3);
-});
+// 显示搜索结果
+const displayResults = computed(() => searchResults.value);
// 执行搜索
function selectActiveResult() {
@@ -146,16 +141,9 @@ function navigateResults(direction: string) {
}
}
-// 跳转
+// 跳转到
function navigateToRoute(item: SearchItem) {
closeSearchModal();
- if (!searchHistory.value.some((history) => history.path === item.path)) {
- searchHistory.value.unshift(item);
- if (searchHistory.value.length > 3) {
- searchHistory.value.pop();
- }
- }
-
if (isExternal(item.path)) {
window.open(item.path, "_blank");
} else {