uni打包的app,运行到真机,自定义气泡再安卓显示正常,ios则是不显示,只有一个markar图片在地图展示,这是基于数据从后端请求过来的时候这么样子的效果,但是如果直接写死数据,ios端的自定义气泡又会正常显示,包括延时器给数据也是不会展示,这个是我这边代码有什么问题吗,还是需要在数据请求成功后再初始化地图进行数据加载呢
<template>
<map id="map" class="map" :show-location="false" :latitude="latitude" :longitude="longitude" @tap="clickmap"
@markertap="callouttap" :marksers="markers" enable-3D @callouttap="callouttap" :scale="scale"
:customCallout="callout" @regionchange="clickmap(2)" enable-overlooking >
<cover-view slot="callout">
<template v-for="(item,index) in markers">
<cover-view :marker-id="item.id" :key="item.id" class="customCallout" :style="{
background:`rgb(${(Math.random()*255 ).toFixed(0)}, ${(Math.random()*255).toFixed(0)}, ${(Math.random()*255).toFixed(0)})`
}">
<cover-image class="icon animation" :src="item.iconPath" @click="dianjiqipao(item)"
style="width: 78rpx;height: 78rpx;border-radius: 30rpx;z-index: 100;">
</cover-image>
<cover-view></cover-view>
</cover-view>
</template>
</cover-view>
</map>
</template>
data() {
return {
markers:[]
}
},
onload(){
this._mapContext = uni.createMapContext("map", this);
},
methods:{
addmarkers(){
let markers = []
//模拟后端请求回来的数据res.data.list
res.data.list.map(item=>{
markers.push(
Object.assign({}, {
id: item.id,
iconPath: item.Avatar,
width: 0,
height: 0,
latitude: Number(item.Latitude), //地图中心经纬度
longitude: Number(item.Longitude), //地图中心经纬度
ariaLabel: `新加的标记点`,
customCallout: {
anchorY: 0, // Y轴偏移量
anchorX: 0, // X轴偏移量
display: 'ALWAYS' // 一直展示
},
}, item)
)
})
this.markers = markers
this._mapContext.addMarkers({
clear: false,
markers: [ ...markers],
complete(res) {
that.markers.push(markers[0])
}
})
}
}
这种请求回来的数据再ios就会不展示自定义气泡,如果再data的markers数组写死,就能在ios显示出来自定义气泡,自定义气泡的display换了点击出现,还是没效果。ios16,