diff --git a/src/views/vehicle/record.vue b/src/views/vehicle/record.vue index e9e9be9..399728b 100644 --- a/src/views/vehicle/record.vue +++ b/src/views/vehicle/record.vue @@ -20,9 +20,6 @@ export default { arr:[], lineArr:null, carMsg:[], - currentIndex:0 ,//索引 - currentObject: null, // 当前显示的对象 - timer: null // 计时器实例 } }, mounted() { @@ -51,22 +48,15 @@ export default { historyMap(this.recordCar).then(res=>{ console.log(res) this.carMsg = res.data - // res.data.forEach(item=>{ - // this.carMsg = item - // this.arr.push(item.longitude.replace(/"/g, "") +","+item.latitude.replace(/"/g, "")) - // this.lineArr = this.arr.map(item => item.trim().replace(/'/g, '').split(',')) - // console.log(this.lineArr) - // }) + res.data.forEach(item=>{ + this.carMsg = item + this.arr.push(item.longitude.replace(/"/g, "") +","+item.latitude.replace(/"/g, "")) + this.lineArr = this.arr.map(item => item.trim().replace(/'/g, '').split(',')) + console.log(this.lineArr) + }) }) this.initMap() 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() { AMapLoader.load({