1将当前定位城市添加到cityList中
2将当前定位城市的索引添加到cityIndex中
async getCityList() {
const res = await axios.get('http://localhost:8080/area/city?level=1')
console.log(res, 'resss')
const { cityList, cityIndex } = formatCityData(res.data.body)
console.log(cityList, cityIndex)
const hotRes = await axios.get('http://localhost:8080/area/hot')
console.log(hotRes, 'hotRes')
cityList['hot']=hotRes.data.body
cityIndex.unshift("hot")
console.log(cityList, cityIndex,"hotList")
//获取当前定位城市
const curcity=await getCurrentCity()
cityList["#"]=[cityList]
cityIndex.unshift("#")
}
微信公众号关注前端小歌谣获取全部代码