()
| 179 | }) |
| 180 | }, |
| 181 | initMap () { |
| 182 | // 气泡图 |
| 183 | Vue.component('x-popCity', { |
| 184 | props: { |
| 185 | option: { |
| 186 | type: Object, |
| 187 | default: () => { |
| 188 | return {}; |
| 189 | }, |
| 190 | }, |
| 191 | id: { |
| 192 | type: String, |
| 193 | default: '' |
| 194 | } |
| 195 | }, |
| 196 | watch: { |
| 197 | 'option.data': { |
| 198 | handler (newVal) { |
| 199 | vm.updateData(this.pointLayer, newVal) |
| 200 | } |
| 201 | } |
| 202 | }, |
| 203 | data () { |
| 204 | return { |
| 205 | scene: null, |
| 206 | pointLayer: null, |
| 207 | data: null |
| 208 | } |
| 209 | }, |
| 210 | beforeDestroy () { |
| 211 | this.scene && this.scene.destroy() |
| 212 | this.scene = null |
| 213 | }, |
| 214 | mounted () { |
| 215 | setTimeout(() => { |
| 216 | this.init() |
| 217 | }, 10); |
| 218 | Object.keys(this.option) |
| 219 | .filter(_ => !["data"].includes(_)) |
| 220 | .forEach(_ => { |
| 221 | this.$watch(vm => vm.option[_], (newValue) => { |
| 222 | vm.updateStyle(this.pointLayer, _, newValue) |
| 223 | this.scene && this.scene.render() |
| 224 | }); |
| 225 | }); |
| 226 | }, |
| 227 | methods: { |
| 228 | updateStyle () { |
| 229 | if (this.pointLayer) { |
| 230 | this.pointLayer.active(this.option.active) |
| 231 | this.pointLayer.color(this.option.color) |
| 232 | this.pointLayer.animate(this.option.animate) |
| 233 | this.pointLayer.size(this.option.size) |
| 234 | this.pointLayer.style({ |
| 235 | opacity: this.option.opacity |
| 236 | }) |
| 237 | } |
| 238 | }, |
nothing calls this directly
no outgoing calls
no test coverage detected