使
用uniapp开发微信小程序使用map组件渲染地图,遇到了一个问题,在微信开发者工具中地图可以正常渲染marker,但是使用真机调试后,地图就不渲染marker,这是为什么?
部分代码如下:
this.$nextTick(() => {
let markers = this.locations.map((x, idx) => ({
id: idx,
realId: x.id,
longitude: x.lng,
latitude: x.lat,
iconPath: '/static/icons/normalpoint.png',
width: 30,
height: 30,
zIndex: 9999,
anchor: {
x: 0.5,
y: 1
},
label: x.name,
})
// new Marker(idx, x.name, x.lng, x.lat,x.id)
)
this.markers = markers
})
<map id="myMap" class="map" :latitude="currentLocation.latitude" :longitude="currentLocation.longitude"
:markers="markers" :scale="scale" @markertap="markertap"
@callouttap="(e) => handleGoGuide(e.detail.markerId)" show-location>
</map>
