使用真机调试看看,我这边真机调试可以显示。
微信小程序的map-polyline中的segmentTexts,在设置后未看到效果?Page({ data: { latitude: 23.099994, longitude: 113.324520, markers: [{ id: 1, latitude: 23.099994, longitude: 113.324520, name: 'T.I.T 创意园' }], polyline: [{ points: [{ latitude: 23.099994, longitude: 113.344520, }, { latitude: 23.199994, longitude: 113.324520, }, { latitude: 23.199984, longitude: 113.304520, }, ], segmentTexts: [{ startIndex: 0, endIndex: 1, name: 'setmengtext1' },{ startIndex: 1, endIndex: 2, name: 'setmengtext2' }], textStyle: { textColor:'#ff0000', strokeColor:'#ff0000', fontSize: 14 }, color: "#fff", width: 15, arrowLine: true, borderWidth: 1 //线的边框宽度,还有很多参数,请看文档 }], covers: [{ latitude: 23.099994, longitude: 113.344520, iconPath: '/image/location.png' }, { latitude: 23.099994, longitude: 113.304520, iconPath: '/image/location.png' }] }, onReady: function (e) { this.mapCtx = wx.createMapContext('myMap') }, getCenterLocation: function () { this.mapCtx.getCenterLocation({ success: function (res) { console.log(res.longitude) console.log(res.latitude) } }) }, moveToLocation: function () { this.mapCtx.moveToLocation() }, translateMarker: function () { this.mapCtx.translateMarker({ markerId: 1, autoRotate: true, duration: 1000, destination: { latitude: 23.10229, longitude: 113.3345211, }, animationEnd() { console.log('animation end') } }) }, includePoints: function () { this.mapCtx.includePoints({ padding: [10], points: [{ latitude: 23.099994, longitude: 113.344520, }, { latitude: 23.199994, longitude: 113.324520, }, { latitude: 23.199984, longitude: 113.304520, }, ] }) } })
03-08