const getParent = $component => ($component.abstract || $component.$el === $component.$children[0].$el) ? getParent($component.$parent) : $component
export default {
    methods: {
        ready() {
            const $rootComponent = getParent(this.$parent)
            this.map = $rootComponent.olmap
            this.load()
        }
    },
    mounted: function() {
        const $rootComponent = getParent(this.$parent)
        const olmap = $rootComponent.olmap
        const {
            ready
        } = this
        if (olmap) {
            ready()
        } else {
            console.log("ready")
            $rootComponent.$on('ready', (config) => {
                this.map = config.map // 获取地图对象------
                this.load() // 地图添加组件---
            })
        }
    }
}