import React, {Component} from 'react' import './CommonExample.css' import {GIS} from "iclient3d-plot-diy"; export default class ExampleSimpleEventPage extends Component { drawOps = []; constructor(props) { super(props); this.state = { htmlString: '

正在加载中...

', }; } componentDidMount() { this.showData(); fetch('./example/ExampleSimpleEventPage.md') .then(response => response.text()) .then(mdText => { this.setState({htmlString: window.marked.parse(mdText)}); }); //监听拨盘事件 } showData() { this.mapFunction.mapApiService.mapClickEvent.addEventListener((id, primitive, isPoint) => { alert(id); }, this); this.mapFunction.mapApiService.mapRightClickEvent.addEventListener((id, primitive, isPoint) => { alert(id); }, this); } render() { return (

自定义事件

{ this.mapFunction = e }} plotUrl={this.state.plotUrl} mapRef={this} showDefaultLayer={true} />
) } }