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