- 用vue写公众号项目,wx.getlocation方法,每次刷新时候,不请求,config也不返回..但是修改保存后就会有,就是不能刷新,请问这是什么问题
mounted () {
this.probeType = 3
this.listenScroll = true
this.map = new window.BMap.Map('baidu')
this.getLocation() // 调用方法顺序: 先获取当前坐标点,再调用接口数据,再初始化地图,设置设备坐标点.
},
methods: {
getLocation () {
let _this = this
console.log('获取地理位置')
window.wx.getLocation({
type: 'gcj02', // 默认为wgs84的gps坐标,如果要返回直接给openLocation用的火星坐标,可传入'gcj02'
success: function (res) {
_this.posInfor = res
_this.xyz.latitude = res.latitude
_this.xyz.longitude = res.longitude
_this.getData()
},
fail: function (err) {
console.log(err)
}
})
},
}

- 如果是页面切入,就可以显示 ,如果是刷新就如上图...

是不是要写在
WeixinJSBridgeReady
回调里才能调用