From da63d7358e2f38ab0493e4f0de5ac5ebc8338b75 Mon Sep 17 00:00:00 2001 From: luJianJun <2587063613@qq.com> Date: Fri, 21 Jul 2023 16:14:58 +0800 Subject: [PATCH] =?UTF-8?q?=E6=90=9C=E7=B4=A2=E4=B8=BA=E7=A9=BA=E5=8F=AF?= =?UTF-8?q?=E4=BB=A5=E8=B7=B3=E8=BD=AC=E6=90=9C=E7=B4=A2=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/seachModule/seachModule.vue | 4 ++-- src/components/seachPage/input.vue | 11 ++++++----- src/views/seachIndex.vue | 5 ++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/components/seachModule/seachModule.vue b/src/components/seachModule/seachModule.vue index 6b731ff..cd42de8 100644 --- a/src/components/seachModule/seachModule.vue +++ b/src/components/seachModule/seachModule.vue @@ -161,11 +161,11 @@ 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..ad22358 100644 --- a/src/components/seachPage/input.vue +++ b/src/components/seachPage/input.vue @@ -3,7 +3,7 @@
- + @@ -181,6 +181,7 @@ let selectTabBoxInfo = ref(null)//个人/中介筛选实例 let apartmentSelectInfo = ref(null)//公寓筛选实例 //设置请求数据 let selectPage = (type) => { + if(type===seachAllType['tabType'])return if (type === 'apartment') { selectTabBoxInfo.value.cleanSelect()//清空筛选数据 } else { @@ -211,7 +212,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' @@ -235,6 +236,7 @@ let checkPageType = () => { } else { seachAllType['intermediary'] = '' } + getDataList(seachAllType) } @@ -379,8 +381,6 @@ let setListCount=(item,num)=>{ } } -//调用判断页面 -checkPageType() watchEffect(() => { seachArea.data = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : [] @@ -388,7 +388,8 @@ watchEffect(() => { }) defineExpose({ searchInit, - setListCount + setListCount, + checkPageType }) diff --git a/src/views/seachIndex.vue b/src/views/seachIndex.vue index 1a912f5..4b296a3 100644 --- a/src/views/seachIndex.vue +++ b/src/views/seachIndex.vue @@ -118,6 +118,7 @@ let getDataList = (data) => { } else { let data = res.data dataList.count = res.data.count + dataCount.value = res.data.count listApartment.value = listApartment.value.concat(data.data) nextTick(() => { masonryInstance.reloadItems(); @@ -186,7 +187,9 @@ onMounted(() => { inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能 route.currentRoute.value.query.keyword='' }else{ - getDataList() + console.log(seachSelectData.data) + inputModuleInfo.value.checkPageType() + // getDataList(seachSelectData.data) } window.addEventListener('scroll', downLoadMore, true); })