| | |
| | | }); |
| | | return baiduMapPromise; |
| | | } |
| | | import { getCurrentPosition } from '@/utils/tool.js' |
| | | |
| | | export default { |
| | | name: 'BaiduMap', |
| | | props: { |
| | |
| | | this.map = null; |
| | | } |
| | | }, |
| | | watch: { |
| | | center: { |
| | | handler: function(val) { |
| | | const newPoint = new BMapGL.Point(val.lng, val.lat); |
| | | this.map.map.setCenter(newPoint) |
| | | }, |
| | | deep: true |
| | | } |
| | | }, |
| | | methods: { |
| | | loadMap() { |
| | | loadBaiduMapScript() |
| | |
| | | map.enableScrollWheelZoom(); |
| | | this.map = map; |
| | | this.$emit('ready', map); |
| | | this.$emit('getMapStatus', 'success') |
| | | this.getUserPosition() |
| | | }, |
| | | async getUserPosition() { |