1.信息窗口插入组件
InfoWindow为引入的组件
//编写函数
setInfoWindow(point) {
const refbd = this.$refs.bdMap//地图实例
const option = {
width: 320, // 信息窗口宽度
height: 120 // 信息窗口高度
}
const MyComponent = Vue.extend({
render: h => h(InfoWindow, {
props: {
info: this.info,
isType: 'baidu'
}, // 组件传值
on: {
handleShowImageList: (point) => {
this.handleShowImageList(point)// 组件事件
}
}
})
})
const component = new MyComponent().$mount()
const infoWindow = new refbd.BMapGL.InfoWindow(component.$mount().$el, option)
refbd.bdmap.openInfoWindow(infoWindow, point)
},
//调用
addDir(){
// 添加窗口
const zbpoint = new refbd.BMapGL.Point(point.lng, point.lat)
this.setInfoWindow(zbpoint)
}
//子组件 InfoWindow里面
handleShowImageList() {
this.$emit('handleShowImageList', this.info)
},
最后编辑于 :
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。