Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/search/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 对地图实例的传单v3和传单上下文菜单插件问题作出反应_Reactjs_Plugins_Leaflet_React Leaflet - Fatal编程技术网

Reactjs 对地图实例的传单v3和传单上下文菜单插件问题作出反应

Reactjs 对地图实例的传单v3和传单上下文菜单插件问题作出反应,reactjs,plugins,leaflet,react-leaflet,Reactjs,Plugins,Leaflet,React Leaflet,react-leavlet-v3中没有可用的映射实例 因此,传单上下文菜单 它不起作用 这个例子说明了我的问题 在MapContainer上创建时,可以使用属性获取地图实例 <MapContainer className="markercluster-map" center={currentLocation} zoom={zoom} maxZoom={18} contextmenu={tru

react-leavlet-v3中没有可用的映射实例

因此,传单上下文菜单 它不起作用

这个例子说明了我的问题

在MapContainer上创建时,可以使用
属性获取地图实例

<MapContainer
        className="markercluster-map"
        center={currentLocation}
        zoom={zoom}
        maxZoom={18}
        contextmenu={true}
        contextmenuItems={[
          {
            text: 'Zoom in',
            callback: this.zoomIn
          },
          { text: 'Zoom out', callback: this.zoomOut }
        ]}
        whenCreated={(map) => this.setState({ map })}
      >
   ...
</MapContainer>

它在中,只是有点难找到:
zoomOut = () => {
    const { map } = this.state;
...
}
zoomIn = () => {
    const { map } = this.state;
...
}