微信公开课
如何看待微信公开课小程序热门讨论「小程序mapCtxgetCenterLocation始终返回0值的经纬度」
摘要:小程序mapCtxgetCenterLocation始终返回0值的经纬度
展开:Page({onReady:function(e){//使用wx.createMapContext获取map上下文this.mapCtxwx.createMapContext(myMap)},getCenterLocation:function(){this.mapCtx.getCenterLocation({success:function(res){console.log(res.longitude)console.log(res.latitude)}})},})//我的代码onLoad:function(options){varthatthis;that.mapCtxwx.createMapContext(myMap);//获取当前位置并移动到此位置wx.getLocation({success:function(res){varlongituderes.longitude;varlatituderes.latitude;//console.log(res)that.setData({longitude:longitude,latitude:latitude})setTimeout(function(){that.mapCtx.moveToLocation();},300);}});},onShow:function(){varthatthis;//获取中心位置console.log(that.mapCtx);that.mapCtx.getCenterLocation({success:function(res){console.log(res);varcenterLgtres.longitude;varcenterLatres.latitude;if(centerLgtthat.data.centerLgtcenterLatthat.data.centerLat){return;}else{that.setData({centerLgt:centerLgt,centerLat:centerLat});getMarkers.call(that,centerLat,centerLgt);}}});},//console返回的结果callbackId:callback110_0_4errMsg:getMapCenterLocation:oklatitude:0longitude:0mapId:0method:getMapCenterLocation是什么原因造成的呢了解更多
方法1:微信扫描微信公开课小程序码即可订阅热门讨论「小程序mapCtxgetCenterLocation始终返回0值的经纬度」
方法2:微信搜索微信公开课小程序名称进入,即可订阅热门讨论「小程序mapCtxgetCenterLocation始终返回0值的经纬度」
方法3:微信网页访问即速商店,长按识别微信公开课小程序码即可订阅热门讨论「小程序mapCtxgetCenterLocation始终返回0值的经纬度」
微信公开课小程序热门讨论「小程序mapCtxgetCenterLocation始终返回0值的经纬度」由微信公开课原创摘录于微信小程序商店shop.jisuapp.cn,转载请注明出处。
微信公开课热门讨论「小程序mapCtxgetCenterLocation始终返回0值的经纬度」由微信公开课开发者向微信用户提供,并对本服务内容、数据资料及其运营行为等真实性、合法性及有效性承担全部责任。