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.
54 lines
1.0 KiB
54 lines
1.0 KiB
<script>
|
|
import commonMixin from '../base/mixins/common.js'
|
|
import {createBounds} from '../base/factory.js'
|
|
|
|
export default {
|
|
name: 'bm-tile',
|
|
render (h) {},
|
|
mixins: [commonMixin('layer')],
|
|
props: {
|
|
transparentPng: {
|
|
type: Boolean
|
|
},
|
|
tileUrlTemplate: {
|
|
type: String
|
|
},
|
|
copyright: {
|
|
},
|
|
zIndex: {
|
|
type: Number
|
|
}
|
|
},
|
|
watch: {
|
|
transparentPng () {
|
|
this.reload()
|
|
},
|
|
tileUrlTemplate () {
|
|
this.reload()
|
|
},
|
|
copyright () {
|
|
this.reload()
|
|
},
|
|
zIndex () {
|
|
this.reload()
|
|
}
|
|
},
|
|
methods: {
|
|
load () {
|
|
const {BMap, map, transparentPng, tileUrlTemplate, copyright, zIndex} = this
|
|
this.originInstance = new BMap.TileLayer({
|
|
transparentPng,
|
|
tileUrlTemplate,
|
|
copyright: copyright && {
|
|
id: copyright.id,
|
|
content: copyright.content,
|
|
bounds: copyright.bounds && createBounds(copyright.bounds)
|
|
},
|
|
zIndex
|
|
})
|
|
map.addTileLayer(this.originInstance)
|
|
}
|
|
}
|
|
}
|
|
</script>
|