输入内容为空也能跳转
This commit is contained in:
@@ -161,11 +161,10 @@ 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>
|
||||||
@@ -211,7 +211,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'
|
||||||
|
|||||||
@@ -182,7 +182,7 @@ onMounted(() => {
|
|||||||
gutter: 20
|
gutter: 20
|
||||||
});
|
});
|
||||||
routeQuery.data = route.currentRoute.value.query
|
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)//调用搜索组件的搜索功能
|
inputModuleInfo.value.searchInit(routeQuery.data.keyword)//调用搜索组件的搜索功能
|
||||||
route.currentRoute.value.query.keyword=''
|
route.currentRoute.value.query.keyword=''
|
||||||
}else{
|
}else{
|
||||||
|
|||||||
Reference in New Issue
Block a user