diff --git a/src/views/vehicle/car.vue b/src/views/vehicle/car.vue index 95037ac..2c42f26 100644 --- a/src/views/vehicle/car.vue +++ b/src/views/vehicle/car.vue @@ -244,6 +244,8 @@ export default { marker: null, lineArr: [], vin:null, + carMsg:null, + carMsgTwo:{}, }; }, mounted() { @@ -253,18 +255,17 @@ export default { this.getList() this.listCarType() this.listFence() - this.realMsg() + this.carMsg = setInterval(this.listRealTime,1000) }, methods: { - realMsg(){ - setInterval(() => { - // 在这里执行后台拉取数据的操作 - listRealTime(this.vin).then(res=>{ - this.lineArr.push(res.longitude.replace(/"/g, "") +","+res.latitude.replace(/"/g, "")) - }) - }, 1000); // 每秒执行一次操作 + // 在这里执行后台拉取数据的操作 + listRealTime(){ + listRealTime(this.vin).then(res=>{ + console.log(res) + this.carMsgTwo = res.data + this.lineArr.push(res.longitude.replace(/"/g, "") +","+res.latitude.replace(/"/g, "")) + }) }, - /*重置表单*/ resetForm() { this.form = { // 这里将form对象重置为空对象或者你定义的初始值 diff --git a/src/views/vehicle/record.vue b/src/views/vehicle/record.vue index bff424b..ace49a5 100644 --- a/src/views/vehicle/record.vue +++ b/src/views/vehicle/record.vue @@ -1,7 +1,7 @@ -