vue-amap点击Marker弹出window窗口显示Marker信息

1. script

let windows = [];//window窗体
let nodes0 = []; //防爆物资 burstPrevention - 点
for (var i = 0; i < mapData.length; i++) {
    mapData[i].key = i;//index值
    mapData[i].content = '
'; //click事件 mapData[i].events= { click: (e)=>{ // console.log("getExtData",e.target.getExtData()); this.windows.forEach(window => { //隐藏所有窗体 window.visible = false; }); //显示点击窗体 this.currentWindow = this.windows[e.target.getExtData().key]; this.$nextTick(() => { this.currentWindow.visible = true; }); } }; let contentWindow = `
  • 物资名称:`+(mapData[i].CONTINGENC_RES_NAME||"")+`
  • 物资类型:`+(mapData[i].RES_TYPE_NAME||"")+`
  • 物资等级:`+(mapData[i].RES_LEVEL_NAME||"")+`
  • 存放位置:`+(mapData[i].RES_PLACE||"")+`
` windows.push({ position: mapData[i].lnglat, content: contentWindow, visible: false }); } this.windows = windows; this.nodes0 = nodes0;

2.template



                
                
                 
          

觉得有用赞一个,谢谢你!

你可能感兴趣的:(vue)