先拓企业站
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

56 lines
1018 B

3 months ago
<template>
<div>
<slot></slot>
</div>
</template>
<script>
import commonMixin from '../base/mixins/common.js'
export default {
name: 'bm-overlay',
mixins: [commonMixin('overlay')],
props: {
pane: {
type: String
}
},
watch: {
pane () {
this.reload()
}
},
methods: {
load () {
const {BMap, map, $el, pane} = this
const $emit = this.$emit.bind(this)
class CustomOverlay extends BMap.Overlay {
initialize () {
$emit('initialize', {
BMap,
map,
el: $el,
overlay: this
})
try {
map.getPanes()[pane].appendChild($el)
} catch (e) {}
return $el
}
draw () {
$emit('draw', {
BMap,
map,
el: $el,
overlay: this
})
}
}
const overlay = new CustomOverlay()
this.originInstance = overlay
map.addOverlay(overlay)
}
}
}
</script>