Conf(地图):使用天地图定位获取省市区

This commit is contained in:
lifizer
2026-01-05 11:03:48 +08:00
parent f4fcc7e8f5
commit 1780c4ff0a
12 changed files with 115 additions and 364 deletions
+8 -4
View File
@@ -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
})
}
},
+9 -6
View File
@@ -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() {