onReady: function (e) {
// 使用 wx.createMapContext 获取 map 上下文
this.mapCtx = wx.createMapContext('#map');
},
controlTap: function (e) {
console.log(e.controlId);
if (e.controlId == 3) {
this.mapCtx.moveToLocation();
}
},
<map id="map" include-points="{{points}}" show-location controls='{{controls}}' bindcontroltap="controlTap" bindmarkertap="markerTap" markers="{{markers}}">
this.mapCtx = wx.createMapContext('#map');
改成:
this.mapCtx = wx.createMapContext('map');
//没有#