From 9f2dcaa4f494256f2fb4f42f65fba2de46a39b56 Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Fri, 21 Jul 2023 15:49:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BE=93=E5=85=A5=E5=86=85=E5=AE=B9=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E4=B9=9F=E8=83=BD=E8=B7=B3=E8=BD=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/seachModule/seachModule.vue | 3 +-- src/components/seachPage/input.vue | 4 ++-- src/views/seachIndex.vue | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/seachModule/seachModule.vue b/src/components/seachModule/seachModule.vue index 6b731ff..db82612 100644 --- a/src/components/seachModule/seachModule.vue +++ b/src/components/seachModule/seachModule.vue @@ -161,11 +161,10 @@ historyArr.data = JSON.parse(localStorage.getItem('historyArr')) || [] let seachList = (item) => { // console.log(123) let string = seachAllType.keyword - if (!string.replace(/\s/g, "")) return if (historyArr.data.indexOf(seachAllType.keyword) === -1) { historyArr.data.push(seachAllType.keyword) } - localStorage.setItem('historyArr', JSON.stringify(historyArr.data)); + if (string.replace(/\s/g, "")) localStorage.setItem('historyArr', JSON.stringify(historyArr.data)); route.push({ path: '/seachPage', query: { diff --git a/src/components/seachPage/input.vue b/src/components/seachPage/input.vue index ddef97a..468be4c 100644 --- a/src/components/seachPage/input.vue +++ b/src/components/seachPage/input.vue @@ -3,7 +3,7 @@
- + @@ -211,7 +211,7 @@ let getDataList = props.getDataList //搜索内容 let seachVal = ref('') let isNeedHousing = ref(false) -seachVal.value = route.currentRoute.value.query.keyword +seachVal.value = route.currentRoute.value.query.keyword.replace(/\s/g, "") //判断是否从求房源页面跳转 isNeedHousing.value = route.currentRoute.value.query.isNeedHousing === 'true' diff --git a/src/views/seachIndex.vue b/src/views/seachIndex.vue index 1a912f5..ba50657 100644 --- a/src/views/seachIndex.vue +++ b/src/views/seachIndex.vue @@ -182,7 +182,7 @@ onMounted(() => { gutter: 20 }); routeQuery.data = route.currentRoute.value.query - if(routeQuery.data.keyword){ + if(routeQuery.data.keyword&&routeQuery.data.keyword.replace(/\s/g, "")){ inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能 route.currentRoute.value.query.keyword='' }else{