riku
2025-09-19 58c0f11fe2f23a1be2dec768f9ac02107301a634
src/utils/map/marks.js
@@ -145,10 +145,17 @@
    return layer;
  },
  createMarker({ position, icon, label, extData }) {
  createMarker({ position, img, label = ' ', extData }) {
    //创建 AMap.Icon 实例:
    const icon = new AMap.Icon({
      size: new AMap.Size(30, 30), //图标尺寸
      image: img, //Icon 的图像
      // imageOffset: new AMap.Pixel(-9, -3), //图像相对展示区域的偏移量,适于雪碧图等
      imageSize: new AMap.Size(30, 30) //根据所设置的大小拉伸或压缩图片
    });
    const marker = new AMap.Marker({
      position: position,
      offset: new AMap.Pixel(-10, -10),
      // offset: new AMap.Pixel(-13, -30),
      icon: icon, //添加 icon 图标 URL
      title: label,
      label: {
@@ -157,7 +164,7 @@
      },
      extData
    });
    map.add(marker);
    // map.add(marker);
    return marker;
  }
};