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

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