markers 自定义点聚合样式时,为什么同时显示marker的默认红色图标?
只有真机调试时会出现,使用默认点聚合样式时显示正常,图片如下: [图片] 自定义点聚合代码如下: // 监听聚合事件
this._mapContext.on('markerClusterCreate',res=>{
console.log('markerClusterCreate',res)
let clusterMarkers = []
const clusters = res.clusters
clusters.map(cluster => {
const {
center,
clusterId,
markerIds
} = cluster
let clusterObj = {
...center,
width: 0,
height: 0,
clusterId,
// iconPath: ``,
joinCluster: true, //核心代码,没有这个自定义样式就不会生效
label: {
content: markerIds.length + '',
fontSize: 16,
color: '#fff',
width: 30,
height: 30,
bgColor: '#5500ff',
borderRadius: 25,
textAlign: 'center',
anchorX: 0,
anchorY: 0,
}
}
clusterMarkers.push(clusterObj)
})
console.log(clusterMarkers)
// 添加聚合簇
that._mapContext .addMarkers({
markers: clusterMarkers,
clear: false, //是否先清空地图上所有的marker
complete(res) {
console.log('监听聚合事件addMarkers', res)
}
})
})
},