diff --git a/src/views/HomeSearch/Hooks/useSurveySearch.ts b/src/views/HomeSearch/Hooks/useSurveySearch.ts index af8acd5..3fea3a8 100644 --- a/src/views/HomeSearch/Hooks/useSurveySearch.ts +++ b/src/views/HomeSearch/Hooks/useSurveySearch.ts @@ -6,7 +6,7 @@ import { getSearchInfo } from '@/api/home/search'; // 问卷 const surveys = ref([]); // 搜索关键词 -const keyword = ref(); +const keyword = ref(''); // 搜索页面索引, 默认第一页 const index = ref(1); // 是否到达最后的列表 @@ -104,7 +104,7 @@ watch(index, async () => { export { keyword, - updateKeyword as handleSearch, + updateKeyword, lastIndex, loading, surveys, diff --git a/src/views/HomeSearch/Index.vue b/src/views/HomeSearch/Index.vue index 71b7e55..90b60f7 100644 --- a/src/views/HomeSearch/Index.vue +++ b/src/views/HomeSearch/Index.vue @@ -2,7 +2,7 @@ import Search from '@/components/Search/Index.vue'; import TemplateMarket from '@/views/HomeSearch/components/TemplateMarket/Index.vue'; import MineSurvey from '@/views/HomeSearch/components/MineSurvey/Index.vue'; -import { handleSearch, keyword, loading } from '@/views/HomeSearch/Hooks/useSurveySearch'; +import { updateKeyword, keyword, loading } from '@/views/HomeSearch/Hooks/useSurveySearch'; import Layout from '@/components/Layout/CommonLayout.vue'; import { visible } from '@/views/HomeSearch/Hooks/useHomeSearch'; import RecommendTag from '@/views/HomeSearch/components/Recommend/Index.vue'; @@ -21,7 +21,7 @@ onMounted(() => { @@ -45,7 +50,7 @@ const { history } = fetchHistory(); color="white" :hit="false" round - @click="handleSearch(tag)" + @click="updateKeyword(tag)" v-for="tag in history" >{{ tag }}