更新实时轨迹9

master
tangwenkang 2023-12-03 21:22:39 +08:00
parent 1337596819
commit b8ad239363
1 changed files with 6 additions and 16 deletions

View File

@ -20,9 +20,6 @@ export default {
arr:[], arr:[],
lineArr:null, lineArr:null,
carMsg:[], carMsg:[],
currentIndex:0 ,//
currentObject: null, //
timer: null //
} }
}, },
mounted() { mounted() {
@ -51,22 +48,15 @@ export default {
historyMap(this.recordCar).then(res=>{ historyMap(this.recordCar).then(res=>{
console.log(res) console.log(res)
this.carMsg = res.data this.carMsg = res.data
// res.data.forEach(item=>{ res.data.forEach(item=>{
// this.carMsg = item this.carMsg = item
// this.arr.push(item.longitude.replace(/"/g, "") +","+item.latitude.replace(/"/g, "")) this.arr.push(item.longitude.replace(/"/g, "") +","+item.latitude.replace(/"/g, ""))
// this.lineArr = this.arr.map(item => item.trim().replace(/'/g, '').split(',')) this.lineArr = this.arr.map(item => item.trim().replace(/'/g, '').split(','))
// console.log(this.lineArr) console.log(this.lineArr)
// }) })
}) })
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({