Fix(寻趣味):获取定位和获取列表是异步,导致定位成功之后获得的城市与列表数据不一致
This commit is contained in:
@@ -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();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user