调用wx.getLocation没有任何反应
发布于 5 年前 作者 nalai 19296 次浏览 来自 问答

这里调用wx.getLocation想获取当前位置并用图标显示出来,但是调用根本没有任何反应,不返回成功也不返回失败,图标也不显示,在别的地方调用也是一样的情况,请问这是怎么回事?

onLoad: function () {

var _this = this;

wx.getLocation({

type: ‘wgs84’, // 默认为 wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标

success: function (res) {

console.log(res)

_this.setData({

latitude: res.latitude,

longitude: res.longitude,

markers: [{

id: “1”,

latitude: res.latitude,

longitude: res.longitude,

width: 50,

height: 50,

iconPath: “/img/map.png”

}]

})

}

2 回复

好像是只要输入APPID就运行不了,不输入APPID图标就可以显示得出来

回到顶部