riku
5 天以前 f19e5267cc23b1c714dc746239864f33ed715dd9
src/utils/map/marks.js
@@ -145,19 +145,27 @@
    return layer;
  },
  createMarker({ position, icon, label, extData }) {
  createMarker({ position, img, title, content, 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,
      content: content,
      title: title,
      label: {
        content: label,
        direction: 'bottom'
      },
      extData
    });
    map.add(marker);
    // map.add(marker);
    return marker;
  }
};