输入内容为空也能跳转
This commit is contained in:
parent
d53616c347
commit
9f2dcaa4f4
@ -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: {
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div class="body-maxWidth ">
|
||||
<div class="input-box dis-f al-item jus-bet body-maxWidth">
|
||||
<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>
|
||||
<img src="../../assets/homeImage/seachIcon.svg" class="icon" alt="" @click="seachList">
|
||||
</template>
|
||||
@ -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'
|
||||
|
@ -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{
|
||||
|
Loading…
x
Reference in New Issue
Block a user