1
y505174330
2024-05-18 920d34a20109cbec85e10b0345baea8723b36352
src/pages/characterMap/characterMap.vue
@@ -152,12 +152,17 @@
        iconAnchor: [24, 41], //  图标将对应标记点的位置 这个是重点, 【值1,值2】,值1:为图标坐标第一个值(即32)的一半,值2:为图标坐标第二个值(即52)
        popupAnchor: [1, -24], // 该点是相对于iconAnchor弹出信息的位置  这个是我手动调出来的,文档默认原始值是[-1,-76],我是去一半值,取一半值调出来的
      });
      let icon = L.divIcon({
        html: "<div class='map-circle-name'></div>",
        iconSize: [80, 80],
        className: "map-circle",
      });
      this.map = map;
      if (info && info.length) {
        for (let i = 0; i < info.length; i++) {
          const item = info[i];
          const marker1 = L.marker([item.ycoord, item.xcoord], {
            icon: DefaultIcon1,
            icon: icon,
          }).addTo(map);
          marker1.on("click", (e) => {
            this.menuNav = true;
@@ -598,4 +603,10 @@
  margin: 0 auto;
  font-size: 14px !important;
}
::v-deep .map-circle-name {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background-color: #2070bc;
}
</style>