需求:需要自定义文本
废话不多说直接上代码👇
// 创建信息窗口
// 自定义文本
let sContent = `<div style="display: flex;flex-direction: column;align-items: center;">
<div style="width:100%;height:50px;padding:10px 15px 0px 15px;color:#fff;font-size:15px;font-weight:600;display: flex;justify-content: space-between;align-items:center;">
<p style="color:black">${item.fullPathName}</p>
<p style="cursor:pointer;color:#4b9ee1;text-decoration:underline">实时视频</p>
</div>
<div style="width:100%;height:332px;padding:0 10px 40px 10px">
<video controls autoplay style="width:100%;height:100%" id="imgDemo"></video>
</div>
<div>`;
//创建信息窗口对象
let infoWindow = new BMapGL.InfoWindow(sContent, {
// 这里是一些提供的接口配置
offset: new BMapGL.Size(-40, -10),//窗口的偏移👈
});
//展示
marker.openInfoWindow(infoWindow); //marker是标记点对象 在此基础上添加窗口
注意:此代码不是完整代码 如有疑问 欢迎留言