- .addArc与.addMarkers方法新增的线和标记点,ios显示正常,安卓不显示?
[图片][图片] 图一:ios 图二:安卓 前提:map使用了【subkey】,使用的腾讯位置服务的个性化地图。 <map id="mapId" wx:if="{{mapFlag}}" subkey="XXXXX-XXXXX-XXXXX-XXXXX-XXXXX-XXXXX" layer-style="1" latitude="37.994405" longitude="101.914715" markers="{{markers}}" polyline="{{polyline}}" scale="{{scale}}" enable-3D="{{false}}" enable-overlooking="{{true}}" enable-traffic="{{true}}" enable-poi="{{true}}" enable-rotate></map> 动态添加markers使用 .addMarkers({}) .addArc({}) 或.setData({}) 都在安卓端不显示。 添加标记点: success: function(res) { if (res.data.code == 200) { const markers = []; res.data.data.forEach((item, index) = >{ markers.push({ id: index, iconPath: that.setIconPath(item.orderNum), longitude: item.lng * 1, latitude: item.lat * 1, width: 15, height: 15, label: { content: item.orderNum.toString(), color: that.setLabelColor(item.orderNum), textAlign: 'center' //文本对d齐方式 left, right, center }, callout: { content: item.city + ' ' + item.orderNum, color: '#041044', borderRadius: 5, bgColor: '#ffffffdb', padding: 5, textAlign: 'center' //文本对齐方式。有效值: left, right, center } }) }); if (that.mapCtx) { that.mapCtx.addMarkers({ clear: true, markers, success: (res) = >{ console.log('addMarkers', res) } }) } } } 添加线: success: function(res) { if (res.data.code == 200) { const indexData = []; res.data.data.forEach((item, index) = >{ indexData.push(index); that.mapCtx.addArc({ id: index, start: { longitude: item.sendCityLng, latitude: item.sendCityLat }, end: { longitude: item.receiveCityLng, latitude: item.receiveCityLat }, //终点 angle: 20, width: 1, color: '#2DC4F6', complete(res) { // console.log('addArc ', res) } }) }); wx.setStorage({ key: "indexData", data: indexData }); that.setData({ mapFlag: true }) } }
2022-07-31 - MapContext.addVisualLayer(Object object)如何使用?
已申请图层ID,我的可视化图层并没有效果 this.mapCtx.addVisualLayer({ layerId: '图层ID', success(res) { console.log('可视化图层成功', res) }, fail(err) { console.log('可视化图层失败', err) } })
2022-07-18