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); })