Conf(地图):使用天地图定位获取省市区
This commit is contained in:
@@ -77,11 +77,15 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
async getMapData() {
|
||||
const map = await getLocation();
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
})
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.cityName = address[1].data.result['ad_info']['city']
|
||||
const {latitude, longitude} = map[1]
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.cityName = address.city
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -140,14 +140,17 @@ export default {
|
||||
},
|
||||
|
||||
async getMapData() {
|
||||
const map = await getLocation();
|
||||
uni.showLoading({
|
||||
title: '定位中...'
|
||||
})
|
||||
const map = await getLocation()
|
||||
if (map.length > 1) {
|
||||
const {latitude, longitude} = map[1];
|
||||
const address = await getCurAddress(latitude, longitude);
|
||||
this.cityName = address[1].data.result['ad_info']['city']
|
||||
const {latitude, longitude} = map[1]
|
||||
getCurAddress(latitude, longitude, address => {
|
||||
this.cityName = address.city
|
||||
this.fetchList()
|
||||
})
|
||||
}
|
||||
|
||||
await this.fetchList()
|
||||
},
|
||||
|
||||
async fetchList() {
|
||||
|
||||
Reference in New Issue
Block a user