参考官方文档
示例代码: wx.getLocation({ type: 'wgs84', success: function(res) { var latitude = res.latitude var longitude = res.longitude var speed = res.speed var accuracy = res.accuracy } })官方文档示例代码 获取到的是用户当前的位置 如果你想给商铺定位需要修改他的坐标位置
// 地图导航 catchmap :function(){ var that = this wx.getLocation({ type: 'gcj02', //返回可以用于wx.openLocation的经纬度 altitude :true, success: function (res) {//也可以在谷歌地图上获取一个位置坐标模拟一下 var latitude = parseInt(that.data.shop_item.lat)//根据后台接口将坐标转换为数字 var longitude =parseInt(that.data.shop_item.lng) console.log(typeof latitude) wx.openLocation({ name:that.data.shop_item.name,//位置名称 address: that.data.shop_item.location,//地址名称 latitude: latitude, //经度 longitude: longitude,//纬度 scale: 28 }) } }) },