cesium实现自定义弹窗
弹窗内容渲染类
import Vue from "vue";
export default class Bubble {
constructor(viewer, position, bubbleType, propsData, offsetHeight) {
this.viewer = viewer;
this.offsetHeight = offsetHeight;
this.position = position;
if (!bubbleType || !bubbleType['beforeCreate'] || !bubbleType['render']) {
throw new Error('弹窗类型不正确!')
}
let WindowVm = Vue.extend(bubbleType);
this.vmInstance = new WindowVm({
propsData: propsData
}).$mount();
this.vmInstance.closeEvent = e => {
this.close();
}
this.viewer.cesiumWidget.container.appendChild(this.vmInstance.$el);
this.addPostRender();
}
addPostRender() {
this.viewer.scene.postRender.addEventListener(this