antvis / L7

🌎 Large-scale WebGL-powered Geospatial Data Visualization analysis engine.
https://l7.antv.antgroup.com
MIT License
3.62k stars 631 forks source link

react hooks 方式初始化 报错 #1558

Open Rayzhangzhang opened 1 year ago

Rayzhangzhang commented 1 year ago
  const draw = () => {
    const scene = new Scene({
      id: 'detail-map-location',
      map: new GaodeMap({
        pitch: 0,
        style: 'amap',
        center: [120.154672, 30.241095],
        zoom: 12,
      }),
      logoVisible: false,
    });
    scene.setMapStatus({ zoomEnable: false });
  };

  React.useEffect(() => {
    draw();
  }, []);

地图能正常显示出来,但是loaded不会执行,也就无法进行后续操作

image

lzxue commented 1 year ago

是不是重复引用了高德地图API,不需要单独引用