赞
踩
代码:openMap() {
let that = this
uni.chooseLocation({
latitude: this.latitude,
longitude: this.longitude,
success: function(res) {
let reg = /.+?(省|市|自治区|自治州|县|区)/g
let address1 = res.address
let address = address1.match(reg)
that.form.locationAddress = res.address.split(address[Number(address.length - 1)])[1] +
res.name
that.form.location = [Number(res.latitude), Number(res.longitude)]
}
});
},
检查后代码无误。
解决:请保证dcloud开发者中心的包名和高德地图sdk上申请key的包名和uniapp打包时的包名三者一致。
1.dcloud开发者设置里的包名
2.高德地图生成地图key时的包名
3.uniapp云打包时包名
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。