输入内容为空也能跳转

This commit is contained in:
luJianJun 2023-07-21 15:49:41 +08:00
parent d53616c347
commit 9f2dcaa4f4
3 changed files with 4 additions and 5 deletions

View File

@ -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: {

View File

@ -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'

View File

@ -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{