sbjw
2025-09-21 b2e11f4ebeb0c935133af2ff63c6aee6addf31a6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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>
        )
    }
}