高德地图加颜色遮罩层

function newLayer(type) {
  if (type === "dom") {
    let dom = document.getElementsByClassName("amap-layers");
    let myShade = document.createElement("div");
    myShade.id = "myShade";
    myShade.class = "mapNew";

    myShade.setAttribute("class", "mapNew");
    dom[0].appendChild(myShade);
    myShade = null;
    dom = null;
  } else {
    let imageLayer = new AMap.ImageLayer({
      url: "/images/mapIcons/mapShart.png",
//世界地图边界值
      bounds: new AMap.Bounds([-180, -85], [180, 85]),
      zooms: [5, 20],
      opacity: 0.2,
    });
    map.add(imageLayer);
  }

  return;
}

你可能感兴趣的:(map,前端,java,javascript)