Fix(寻趣味):获取定位和获取列表是异步,导致定位成功之后获得的城市与列表数据不一致

This commit is contained in:
lifizer
2024-03-11 11:04:54 +08:00
parent 39ff2af49e
commit cb92a1f44f
+5 -3
View File
@@ -10,7 +10,7 @@ export default {
page: 1,
typeList: [],
typeIndex: 0,
cityName: "昆明市",
cityName: "",
hotelList: [],
}
},
@@ -18,8 +18,6 @@ export default {
this.getMapData();
getHotelTypeList().then(({data}) => {
this.typeList = data;
console.log("getHotelTypeList")
this.search();
});
},
onShow() {
@@ -32,6 +30,9 @@ export default {
}
},
onReachBottom() {
if (!this.cityName) {
return
}
this.page++;
this.fetchList();
},
@@ -54,6 +55,7 @@ export default {
const {latitude, longitude} = map[1];
const address = await getCurAddress(latitude, longitude);
this.cityName = address[1].data.result.ad_info.city;
this.search();
}
},