diff --git a/src/components/MapBox.vue b/src/components/MapBox.vue index fa51d9c..3c447d2 100644 --- a/src/components/MapBox.vue +++ b/src/components/MapBox.vue @@ -154,8 +154,21 @@ export default { projection: 'globe' }) // 地图控件 - this.map.addControl(new mapboxgl.NavigationControl(), 'top-right') - this.map.addControl(new mapboxgl.ScaleControl(), 'top-right') + this.map.addControl(new mapboxgl.NavigationControl(), 'top-right')// 移动旋转指南针 + // this.map.addControl(new mapboxgl.ScaleControl(), 'top-right')// 地图比例 + this.map.addControl(new mapboxgl.FullscreenControl(), 'top-right')// 全屏 + // Add geolocate control to the map. + this.map.addControl( + new mapboxgl.GeolocateControl({ + positionOptions: { + enableHighAccuracy: true + }, + // When active the map will receive updates to the device's location as it changes. + trackUserLocation: true, + // Draw an arrow next to the location dot to indicate which direction the device is heading. + showUserHeading: true + }) + ) }, /** * @description: 清除地图上的航线