From d76730c5208e262ed94bd0235cc2f28f179925e2 Mon Sep 17 00:00:00 2001 From: tangwenkang <2720983602@qq.com> Date: Sun, 3 Dec 2023 19:50:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=AE=9E=E6=97=B6=E8=BD=A8?= =?UTF-8?q?=E8=BF=B94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/vehicle/car.vue | 19 ++++++++++--------- src/views/vehicle/record.vue | 15 ++++++++------- 2 files changed, 18 insertions(+), 16 deletions(-) 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 @@ -