CityList.vue
855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<script>
import commonMixin from '../base/mixins/common.js'
import {createSize} from '../base/factory.js'
export default {
name: 'bm-city-list',
render () {},
mixins: [commonMixin('control')],
props: {
anchor: {
type: String
},
offset: {
type: Object
}
},
watch: {
anchor () {
this.reload()
},
offset () {
this.reload()
}
},
methods: {
load () {
const {BMap, map, anchor, offset} = this
const self = this
this.originInstance = new BMap.CityListControl({
anchor: global[anchor],
offset: offset && createSize(BMap, offset),
onChangeBefore () {
self.$emit('changeBefore')
},
onChangeAfter () {
self.$emit('changeAfter')
}
})
map.addControl(this.originInstance)
}
}
}
</script>