准备
微信小程序获得这个接口
html
<view class="maps">
<map style="width: 750rpx; height: 750rpx;" show-location :latitude="location.latitude"
:longitude="location.longitude" min-scale='15'/>
</view>
js
uni.getLocation({
type: 'gcj02',
geocode:true,
success: function (res) {
console.log(res);
location.longitude= res.longitude
location.latitude= res.latitude
},
fail(e) {
console.log(e);
},
});
manifest.josn源码视图
setting同级
"permission": {
"scope.userLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
},
"scope.userFuzzyLocation": {
"desc": "你的位置信息将用于小程序位置接口的效果展示"
}
},
"requiredPrivateInfos": ["chooseLocation", "getLocation"]