Panorama.vue 617 B

1234567891011121314151617181920212223242526272829
  1. <script>
  2. import commonMixin from '../base/mixins/common.js'
  3. import { createSize } from '../base/factory.js'
  4. export default {
  5. name: 'bm-panorama',
  6. mixins: [commonMixin('control')],
  7. render() { },
  8. props: ['anchor', 'offset'],
  9. watch: {
  10. anchor() {
  11. this.reload()
  12. },
  13. offset() {
  14. this.reload()
  15. }
  16. },
  17. methods: {
  18. load() {
  19. const { BMap, map, anchor, offset } = this
  20. this.originInstance = new BMap.PanoramaControl({
  21. anchor: window[anchor],
  22. offset: offset && createSize(BMap, offset)
  23. })
  24. map.addControl(this.originInstance)
  25. }
  26. }
  27. }
  28. </script>