core/baseClass.js

/**
 * 
 */

class BaseClass {
    /**
     * 基类
     * @param {dom} dom dom对象
     * @param {map} map map对象
     */
    constructor({dom, map} = {}) {

        this.dom = dom;
        this._show = true;
        this.map = map;

    }

    /**
     * 切换地图显示隐藏状态
     */
    tollgeShow() {

        if (this._show === false) {

            this.dom.style.display = 'block';

        } else {

            this.dom.style.display = 'none';

        }

    }

    /**
     *获取dom对象
     * @returns {dom}
     */
    getDom() {

        return this.dom;
    
    }

    /**
     *设置dom
     * @param {dom} dom dom对象
     */
    setDom(dom) {

        this.dom = dom;

    }

    /**
     * 隐藏对象
     */
    hide() {

        this.dom.style.display = 'none';
        this._show = false;

    }

    /**
     * 显示dom对象
     */
    show() {

        this.dom.style.display = 'block';
        this._show = true;

    }
}

export default BaseClass;