输入框内容为空时搜索内容,设置为前一个搜索内容

This commit is contained in:
2023-08-02 14:47:08 +08:00
parent 5407042a87
commit 9c958fd85b

View File

@@ -214,6 +214,7 @@ let selectPage = (type) => {
tabType.value = type tabType.value = type
seachAllType['tabType'] = type seachAllType['tabType'] = type
seachAllType['searchid'] = setPageKey() seachAllType['searchid'] = setPageKey()
//根据类型初始化筛选参数
if (type === 'person') { if (type === 'person') {
seachAllType['intermediary'] = 0 seachAllType['intermediary'] = 0
seachAllType['isintermediary'] = 0 seachAllType['isintermediary'] = 0
@@ -232,7 +233,11 @@ let selectPage = (type) => {
seachAllType['isverified'] = 0 seachAllType['isverified'] = 0
seachAllType['isintermediary'] = 0 seachAllType['isintermediary'] = 0
} }
if ((seachVal.value && !setPageKey()))return //初始化搜索框输入内容
if (tabType.value != 'need') {
setSeachVal()
}
if ((seachVal.value && !setPageKey())) return
getDataList(seachAllType) getDataList(seachAllType)
} }
@@ -297,10 +302,15 @@ if (isNeedHousing.value) {
seachAllType['intermediary'] = 6 seachAllType['intermediary'] = 6
} }
//切换选项重置输入框内容
let setSeachVal = () => {
seachAllType['searchid'] = setPageKey()
seachVal.value = seachKey.key.keyword
}
//设置搜索数据 //设置搜索数据
let setSeachConditions = (type, data) => { let setSeachConditions = (type, data) => {
// console.log(1,seachAllType) // console.log(1,seachAllType)
console.log(data)
if (seachAllType['tabType'] !== 'apartment') { if (seachAllType['tabType'] !== 'apartment') {
if (type === 'rent') { if (type === 'rent') {
seachAllType['rent_min'] = data.min seachAllType['rent_min'] = data.min
@@ -322,10 +332,16 @@ let setSeachConditions = (type, data) => {
} else { } else {
seachAllType = { seachAllType = {
tabType: 'apartment', tabType: 'apartment',
searchid: setPageKey(),
...type.value ...type.value
} }
} }
if (tabType.value != 'need') {
setSeachVal()
}else if(tabType.value=='need'){
seachVal.value = seachAllType.keyword
}
if (!seachAllType['tabType']) seachAllType['tabType'] = tabType.value if (!seachAllType['tabType']) seachAllType['tabType'] = tabType.value
if (!seachVal.value) { if (!seachVal.value) {
seachAllType.searchid = '' seachAllType.searchid = ''