我反复试了一下是偏移量的问题,没有设置偏移量的话,就会显示,设置了偏移量就不显示,不知道是什么原因!
map组件,设置了makers,开发工具中显示正常,真机调试时maker都不显示了,是什么原因呢?我的相关代码如下: wxml: <map control="true" class="map" id="locationMap" longitude="{{longitude}}" latitude="{{latitude}}" scale="{{curScale}}" show-location="false" markers="{{markers}}" bindmarkertap="makertap"></map> js: app.BeeRequest(null, app.globalData.requestPositions, 'GET', that, function (res) { if (res.code == 0) { if (res.data && res.data.length > 0) { let markers = [] res.data.forEach((_item,idx) => { let maker = that.createMaker(_item, idx) if (maker) { markers.push(maker) } }); that.setData({markers}) } else { that.setData({ nodata: true }) } } else { that.setData({ errTip: res.msg, error: true }) } }) createMaker(_item, idx) { let maker = {} maker.id = idx maker.longitude = _item.zxjd maker.latitude = _item.zxwd maker.joinCluster = true maker.clusterId = _item.id maker.title = _item.cph maker.iconPath = "../../images/car_icon.png" maker.anchor = {x:0.5,y:0.5} maker.callout = {content: _item.cph, color: '#ff0c28', borderRadius: 5, borderColor: '#ff0c28', borderWidth: 1, padding: 5, fontSize: 12, display: 'ALWAYS', textAlign: 'center', anchorX: 0, anchorY: 35} maker.rotate = _item.xsfx maker.width = 40 maker.height = 40 return maker; },
2021-12-27