From a627a4b0ecc92f18ae3ff48b5e0a7a97dd1e939c Mon Sep 17 00:00:00 2001 From: expdsn <18111002318@163.com> Date: Mon, 11 Nov 2024 17:53:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=90=9C=E7=B4=A2=E6=A0=8F?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/layout/header/search/SearchHistory.tsx | 9 ++++----- src/layout/header/search/SearchSuggestion.tsx | 13 +++++++++++-- src/layout/header/search/useSearchStore.ts | 7 +++++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/src/layout/header/search/SearchHistory.tsx b/src/layout/header/search/SearchHistory.tsx index 01239dc..e589a70 100644 --- a/src/layout/header/search/SearchHistory.tsx +++ b/src/layout/header/search/SearchHistory.tsx @@ -1,11 +1,10 @@ import { defineComponent } from 'vue' import { OhVueIcon, addIcons } from 'oh-vue-icons' -import { MdHistory, MdRemove } from 'oh-vue-icons/icons' +import { MdHistory, MdRemove, RiCloseCircleLine } from 'oh-vue-icons/icons' import useSearchConfigStore from './useSearchConfigStore' import jump from '@/utils/jump' import useSettingsStore from '@/settings/useSettingsStore' -addIcons(MdHistory) -addIcons(MdRemove) +addIcons(MdHistory, RiCloseCircleLine) export default defineComponent(() => { const searchConfig = useSearchConfigStore() const settings = useSettingsStore() @@ -15,7 +14,7 @@ export default defineComponent(() => { {searchConfig.history.map((item, idx) => (
{ jump(searchConfig.current.url + item) }} @@ -34,7 +33,7 @@ export default defineComponent(() => { searchConfig.removeHistory(idx) }} > - +
))} diff --git a/src/layout/header/search/SearchSuggestion.tsx b/src/layout/header/search/SearchSuggestion.tsx index a924f3c..4691c42 100644 --- a/src/layout/header/search/SearchSuggestion.tsx +++ b/src/layout/header/search/SearchSuggestion.tsx @@ -23,7 +23,7 @@ export const Item = defineComponent({ return () => (
{ @@ -46,7 +46,7 @@ export default defineComponent(() => { const searchConfig = useSearchConfigStore() return () => ( -
+
{ current={search.current} num={1} /> + { + search.addList.map((el, idx) => ( +
+ icon + {el.name} + +
+ )) + } {search.sugList.map((el, idx) => ( { ) const debouncedHandler = debounce((newValue) => { console.log('数值改变并已防抖处理:', newValue) - request("GET", `/api/app/searchBars`).then((res) => { + request("GET", `/api/app/searchBars?keyword=${newValue || 'undefine'}`).then((res) => { addList.value = res + console.log(addList.value); + }) }, 500) // watch(searchStr, (newValue) => { @@ -111,6 +113,7 @@ export default defineStore('search', () => { focus, showSearchConfig, current, - sugList + sugList, addList + } })