This commit is contained in:
duanliang
2025-04-02 20:40:37 +08:00
parent 99f6129b59
commit 3029752b97
4 changed files with 51 additions and 3 deletions

View File

@@ -130,12 +130,43 @@
nextTick(()=>{
val[0].forEach((item,index)=>{
addMarker(mapIcon,[item.longitude,item.latitude],[40, 60])
marker.value.addEventListener('click', (e) => {
console.log(item,'111111111111')
cameraIndexCode.value = item.cameraIndexCode
isCollect.value = item.isCollect
getPreviewUrl(item.cameraIndexCode)
})
var opts = {
position: new BMapGL.Point(item.longitude, item.latitude), // 指定文本标注所在的地理位置
offset: new BMapGL.Size(-100, 30) // 设置文本偏移量
};
// 创建文本标注对象
var label = new BMapGL.Label(item.cameraName, opts);
// 自定义文本标注样式
label.setStyle({
display:'block',
color: '#0b61b4',
borderRadius: '0',
borderColor: 'none',
padding: '10px',
border:0,
fontWeight:'bold',
fontFamily: '微软雅黑'
});
marker.value.addEventListener('mouseover', (e) => {
label.setStyle({
display:'block'
});
map.value.addOverlay(label);
})
marker.value.addEventListener('mouseout', (e) => {
console.log('11111')
label.setStyle({
display:'none'
});
})
})
})