|
|
@ -13,6 +13,7 @@ function Markers(props) { |
|
|
|
iconAnchor = [15, 20], // 图片偏移量 |
|
|
|
tooltipKey = "name", // 提示信息的key |
|
|
|
// contentCb, // 生成弹窗显示内容方法事件 |
|
|
|
mover = false, |
|
|
|
clickCb, // 点击事件 |
|
|
|
} = props; |
|
|
|
var Mapmove = new AMap.Marker({ content: " ", map: map }); |
|
|
@ -128,27 +129,30 @@ function Markers(props) { |
|
|
|
_massLayer.on("click", function (e) { |
|
|
|
clickCb(e.data.option); |
|
|
|
}); |
|
|
|
_massLayer.on("mouseover", function (e) { |
|
|
|
console.log(e); |
|
|
|
Mapmove.setPosition(e.data.lnglat); |
|
|
|
Mapmove.setLabel({ |
|
|
|
content: `${e.data.name} (${e.data?.option?.userTotal}/${e.data?.option?.berthTotal})`, |
|
|
|
if (mover) { |
|
|
|
_massLayer.on("mouseover", function (e) { |
|
|
|
console.log(e); |
|
|
|
Mapmove.setPosition(e.data.lnglat); |
|
|
|
Mapmove.setLabel({ |
|
|
|
content: `${e.data.name} (${e.data?.option?.userTotal}/${e.data?.option?.berthTotal})`, |
|
|
|
}); |
|
|
|
// if (position) { |
|
|
|
// Mapmove.setContent( |
|
|
|
// '<div class="amap-info-window">' + |
|
|
|
// position + |
|
|
|
// '<div class="amap-info-sharp"></div>' + |
|
|
|
// "</div>" |
|
|
|
// ); |
|
|
|
// Mapmove.setPosition(position); |
|
|
|
// // map.add(Mapmove); |
|
|
|
// } |
|
|
|
}); |
|
|
|
// if (position) { |
|
|
|
// Mapmove.setContent( |
|
|
|
// '<div class="amap-info-window">' + |
|
|
|
// position + |
|
|
|
// '<div class="amap-info-sharp"></div>' + |
|
|
|
// "</div>" |
|
|
|
// ); |
|
|
|
// Mapmove.setPosition(position); |
|
|
|
// // map.add(Mapmove); |
|
|
|
// } |
|
|
|
}); |
|
|
|
|
|
|
|
_massLayer.on("mouseout", function () { |
|
|
|
// map.remove(Mapmove); |
|
|
|
}); |
|
|
|
_massLayer.on("mouseout", function () { |
|
|
|
map.remove(Mapmove); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
// setMassLayer(_massLayer); |
|
|
|
_massLayer.setMap(map); |
|
|
|
}; |
|
|
|