edit | blame | history | raw

ExampleHideToolBarPage 代码

import React, {Component, PureComponent} from 'react'
import './CommonExample.css'
import {GIS} from "../iclient3d-plot-diy";

;
import {Button} from "antd";

export default class ExampleHideToolBarPage extends PureComponent {
    constructor(props) {
        super(props);
        this.state = {
            htmlString: '<h3>正在加载中...</h3>'
        };
    }

    componentDidMount() {
        this.mapFunction.hideToolBar();
        fetch('./example/ExampleHideToolBarPage.md')
            .then(response => response.text())
            .then(mdText => {
                this.setState({htmlString: window.marked.parse(mdText)});
            });
    }

    render() {
        return (
            <div className={"example"}>
                <h3>工具栏控制</h3>
                <div className={"map_wrapper"}>
                    <GIS refs={e => {
                        this.mapFunction = e
                    }} mapRef={this}/>
                </div>
                <Button type="primary" onClick={() => this.mapFunction.hideToolBar()}>隐藏默认工具栏</Button>
                <Button type="primary" onClick={() => this.mapFunction.showToolBar()}>显示默认工具栏</Button>
                <Button type="primary" onClick={() => this.mapFunction.hideStateBar()}>隐藏状态工具栏</Button>
                <Button type="primary" onClick={() => this.mapFunction.showStateBar()}>显示状态工具栏</Button>
                <div className={"code_wrapper"}>
                    <div dangerouslySetInnerHTML={{__html: this.state.htmlString}}></div>
                </div>
            </div>
        )
    }
}