|
|
@@ -57,6 +57,7 @@ export default {
|
|
|
AMap: null,
|
|
|
map: null,
|
|
|
infoWindow: null,
|
|
|
+ trafficLayer: null,
|
|
|
routeGroups: {},
|
|
|
polylines: [],
|
|
|
privateStyle: {
|
|
|
@@ -257,13 +258,25 @@ export default {
|
|
|
});
|
|
|
|
|
|
this.map.on('complete', () => {
|
|
|
- if (!this._isDestroyed) this.drawStaticRoutes();
|
|
|
+ if (!this._isDestroyed) {
|
|
|
+ this.drawStaticRoutes();
|
|
|
+ this.enableTrafficLayer();
|
|
|
+ }
|
|
|
});
|
|
|
} catch (err) {
|
|
|
console.error('地图加载失败:', err);
|
|
|
}
|
|
|
},
|
|
|
|
|
|
+ enableTrafficLayer() {
|
|
|
+ if (!this.isMapReady() || !this.AMap.TileLayer) return;
|
|
|
+ this.trafficLayer = new this.AMap.TileLayer.Traffic({
|
|
|
+ zIndex: 10,
|
|
|
+ autoRefresh: true
|
|
|
+ });
|
|
|
+ this.map.add(this.trafficLayer);
|
|
|
+ },
|
|
|
+
|
|
|
drawStaticRoutes() {
|
|
|
if (!this.isMapReady()) return;
|
|
|
|