搜索为空可以跳转搜索页
This commit is contained in:
@@ -161,11 +161,11 @@ historyArr.data = JSON.parse(localStorage.getItem('historyArr')) || []
|
|||||||
let seachList = (item) => {
|
let seachList = (item) => {
|
||||||
// console.log(123)
|
// console.log(123)
|
||||||
let string = seachAllType.keyword
|
let string = seachAllType.keyword
|
||||||
if (!string.replace(/\s/g, "")) return
|
|
||||||
if (historyArr.data.indexOf(seachAllType.keyword) === -1) {
|
if (historyArr.data.indexOf(seachAllType.keyword) === -1) {
|
||||||
historyArr.data.push(seachAllType.keyword)
|
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({
|
route.push({
|
||||||
path: '/seachPage',
|
path: '/seachPage',
|
||||||
query: {
|
query: {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="body-maxWidth ">
|
<div class="body-maxWidth ">
|
||||||
<div class="input-box dis-f al-item jus-bet body-maxWidth">
|
<div class="input-box dis-f al-item jus-bet body-maxWidth">
|
||||||
<div class="dis-f al-item">
|
<div class="dis-f al-item">
|
||||||
<el-input v-model="seachVal" class="input-s" placeholder="输入关键字" @keyup.enter='seachList'>
|
<el-input v-model="seachVal" class="input-s" placeholder="搜索房源或输入房源ID" @keyup.enter='seachList'>
|
||||||
<template #suffix>
|
<template #suffix>
|
||||||
<img src="../../assets/homeImage/seachIcon.svg" class="icon" alt="" @click="seachList">
|
<img src="../../assets/homeImage/seachIcon.svg" class="icon" alt="" @click="seachList">
|
||||||
</template>
|
</template>
|
||||||
@@ -181,6 +181,7 @@ let selectTabBoxInfo = ref(null)//个人/中介筛选实例
|
|||||||
let apartmentSelectInfo = ref(null)//公寓筛选实例
|
let apartmentSelectInfo = ref(null)//公寓筛选实例
|
||||||
//设置请求数据
|
//设置请求数据
|
||||||
let selectPage = (type) => {
|
let selectPage = (type) => {
|
||||||
|
if(type===seachAllType['tabType'])return
|
||||||
if (type === 'apartment') {
|
if (type === 'apartment') {
|
||||||
selectTabBoxInfo.value.cleanSelect()//清空筛选数据
|
selectTabBoxInfo.value.cleanSelect()//清空筛选数据
|
||||||
} else {
|
} else {
|
||||||
@@ -211,7 +212,7 @@ let getDataList = props.getDataList
|
|||||||
//搜索内容
|
//搜索内容
|
||||||
let seachVal = ref('')
|
let seachVal = ref('')
|
||||||
let isNeedHousing = ref(false)
|
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'
|
isNeedHousing.value = route.currentRoute.value.query.isNeedHousing === 'true'
|
||||||
@@ -235,6 +236,7 @@ let checkPageType = () => {
|
|||||||
} else {
|
} else {
|
||||||
seachAllType['intermediary'] = ''
|
seachAllType['intermediary'] = ''
|
||||||
}
|
}
|
||||||
|
getDataList(seachAllType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -379,8 +381,6 @@ let setListCount=(item,num)=>{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用判断页面
|
|
||||||
checkPageType()
|
|
||||||
|
|
||||||
watchEffect(() => {
|
watchEffect(() => {
|
||||||
seachArea.data = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : []
|
seachArea.data = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : []
|
||||||
@@ -388,7 +388,8 @@ watchEffect(() => {
|
|||||||
})
|
})
|
||||||
defineExpose({
|
defineExpose({
|
||||||
searchInit,
|
searchInit,
|
||||||
setListCount
|
setListCount,
|
||||||
|
checkPageType
|
||||||
})
|
})
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -118,6 +118,7 @@ let getDataList = (data) => {
|
|||||||
} else {
|
} else {
|
||||||
let data = res.data
|
let data = res.data
|
||||||
dataList.count = res.data.count
|
dataList.count = res.data.count
|
||||||
|
dataCount.value = res.data.count
|
||||||
listApartment.value = listApartment.value.concat(data.data)
|
listApartment.value = listApartment.value.concat(data.data)
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
masonryInstance.reloadItems();
|
masonryInstance.reloadItems();
|
||||||
@@ -186,7 +187,9 @@ onMounted(() => {
|
|||||||
inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能
|
inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能
|
||||||
route.currentRoute.value.query.keyword=''
|
route.currentRoute.value.query.keyword=''
|
||||||
}else{
|
}else{
|
||||||
getDataList()
|
console.log(seachSelectData.data)
|
||||||
|
inputModuleInfo.value.checkPageType()
|
||||||
|
// getDataList(seachSelectData.data)
|
||||||
}
|
}
|
||||||
window.addEventListener('scroll', downLoadMore, true);
|
window.addEventListener('scroll', downLoadMore, true);
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user