首页添加底部导航 修改区域选项设置
This commit is contained in:
@@ -106,22 +106,18 @@ let historyArr = reactive({ data: [] })//历史查找记录
|
||||
let hotArr = reactive({ data: [] })
|
||||
|
||||
//获取区域下列数据
|
||||
let getLocationData = () => {
|
||||
let getLocationData = (data) => {
|
||||
console.log(seachArea.data)
|
||||
api.getLocationData().then(res => {
|
||||
console.log(res)
|
||||
if (res.code === 200) {
|
||||
for (let item in res.data) {
|
||||
if (!seachArea.data[item.substring(0, 1) - 1].data) seachArea.data[item.substring(0, 1) - 1].data = []
|
||||
if (item.length > 1) {
|
||||
seachArea.data[item.substring(0, 1) - 1].data.push({
|
||||
title: res.data[item],
|
||||
id: item
|
||||
})
|
||||
}
|
||||
}
|
||||
for (let item in data) {
|
||||
if (!seachArea.data[item.substring(0, 1) - 1].data) seachArea.data[item.substring(0, 1) - 1].data = []
|
||||
if (item.length > 1) {
|
||||
seachArea.data[item.substring(0, 1) - 1].data.push({
|
||||
title: data[item],
|
||||
id: item
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
console.log(store.state)
|
||||
}
|
||||
|
||||
//监听路由
|
||||
@@ -134,7 +130,8 @@ watchEffect(() => {
|
||||
hireType.data = store.state.seachTypeData[2] ? store.state.seachTypeData[2].where[0].data : []
|
||||
allHireType.data = store.state.seachTypeData[2] ? store.state.seachTypeData[2].where[1].data : []
|
||||
seachArea.data = store.state.seachTypeData[1] ? store.state.seachTypeData[1].where : []
|
||||
if (seachArea.data.length > 0&&!seachArea.data[0].data) getLocationData()
|
||||
if (seachArea.data.length > 0 && !seachArea.data[0].data) getLocationData(store.state.indexData.config.location
|
||||
)
|
||||
hotArr.data = store.state.indexData.hotSearcheWords
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user