Selected Gaode map positioning
The small program steps are as follows:
1. First create the application
2. Click the Add key button to apply for a Mini Program key
3. Then download its WeChat Mini Program SDK: WeChat Mini Program SDK
4. Put the downloaded sdk in the public file, here I put it in the utils file directory
5. Import this method using the page
// 引入高德地图sdk
import amap from '@/utils/amap-wx.130.js';
6. All AutoNavi maps obtain the current location code of the applet
import amap from '@/utils/amap-wx.130.js';
export default {
data() {
return {
amapPlugin: null,
key: '高德key',
addressName: '',
weather: {
hasData: false,
data: []
}
}
},
onLoad() {
this.amapPlugin = new amap.AMapWX({
key: this.key
});
},
methods: {
getRegeo() {
uni.showLoading({
title: '获取信息中'
});
this.amapPlugin.getRegeo({
success: (data) => {
console.log(data)
this.addressName = data[0].name;
uni.hideLoading();
}
});
}
}
}
All in all, the calling method of AutoNavi Maps is more convenient than that of Tencent Maps, but each has different advantages. What to use depends on your own needs and the main account of the company! ! !