我是将map封装成了子组件进行使用,发现wx.createMapContext无论如何都没有效果。最后,定睛一看,原来将map放到子组件中,再使用wx.createMapContext需要增加额外的参数this
具体使用方法如下:
 const mapCtx = wx.createMapContext('map', this);mapCtx.includePoints({padding: [10],points: [{latitude: 23.10229,longitude: 113.3345211}, {latitude: 23.00229,longitude: 113.3345211}],success(res) {console.log(res)},fail(res) {console.log(res)}})
官方说明文档:
 