更新实时轨迹7
parent
690531cd40
commit
15f2ab96da
|
@ -19,13 +19,14 @@ export default {
|
||||||
},
|
},
|
||||||
arr:[],
|
arr:[],
|
||||||
lineArr:null,
|
lineArr:null,
|
||||||
carMsg:[]
|
carMsg:[],
|
||||||
|
currentIndex:0 ,//索引
|
||||||
|
currentObject: null, // 当前显示的对象
|
||||||
|
timer: null // 计时器实例
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
setInterval(() => {
|
|
||||||
this.historyMap();
|
|
||||||
}, 1000);
|
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.getList()
|
this.getList()
|
||||||
|
@ -58,6 +59,13 @@ export default {
|
||||||
})
|
})
|
||||||
this.initMap()
|
this.initMap()
|
||||||
this.startAnimation()
|
this.startAnimation()
|
||||||
|
this.currentObject = this.carMsg[this.currentIndex]; // 初始展示第一个对象
|
||||||
|
|
||||||
|
// 设置计时器,每秒切换到下一个对象
|
||||||
|
this.timer = setInterval(() => {
|
||||||
|
this.currentIndex = (this.currentIndex + 1) % this.carMsg.length; // 切换到下一个对象
|
||||||
|
this.currentObject = this.carMsg[this.currentIndex]; // 更新当前显示的对象
|
||||||
|
}, 1000);
|
||||||
},
|
},
|
||||||
initMap() {
|
initMap() {
|
||||||
AMapLoader.load({
|
AMapLoader.load({
|
||||||
|
|
Loading…
Reference in New Issue