Panorama.vue 616 B

123456789101112131415161718192021222324252627282930
  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: global[anchor],
  22. offset: offset && createSize(BMap, offset)
  23. })
  24. map.addControl(this.originInstance)
  25. }
  26. }
  27. }
  28. </script>