From dafe9cc1978603a8c3677854fe877f809f4822df Mon Sep 17 00:00:00 2001 From: tk Date: Wed, 7 Aug 2024 18:39:11 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E7=B1=BB=20=20=E5=9E=8B=E3=80=91?= =?UTF-8?q?=EF=BC=9Afix=20=E8=AE=A2=E9=98=85=E4=BF=A1=E6=81=AF=20=E9=A3=9E?= =?UTF-8?q?=E6=9C=BA=E7=8A=B6=E6=80=81=E8=B5=8B=E5=80=BCbug=20=E3=80=90?= =?UTF-8?q?=E5=8E=9F=20=20=E5=9B=A0=E3=80=91=EF=BC=9A=E5=BF=83=E8=B7=B3?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=E6=B2=A1=E6=9C=89=E5=86=99=E9=81=93?= =?UTF-8?q?=E9=A3=9E=E6=9C=BA=E7=8A=B6=E6=80=81=E5=B1=9E=E6=80=A7=E9=87=8C?= =?UTF-8?q?=E9=9D=A2=20=E3=80=90=E8=BF=87=20=20=E7=A8=8B=E3=80=91=EF=BC=9A?= =?UTF-8?q?=20=E3=80=90=E5=BD=B1=20=20=E5=93=8D=E3=80=91=EF=BC=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/PlaneStatus.vue | 16 ++++++---------- src/views/layout/index.vue | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/components/PlaneStatus.vue b/src/components/PlaneStatus.vue index 3ae6235..aeadded 100644 --- a/src/components/PlaneStatus.vue +++ b/src/components/PlaneStatus.vue @@ -9,7 +9,6 @@
- {{ plane.planeState.state }}
@@ -20,28 +19,21 @@
- {{ plane.planeState.fixType }} -
-
- {{ satCount }}颗
- {{ plane.planeState.voltagBattery }}V
- {{ plane.planeState.currentBattery }}A
- {{ plane.planeState.battCapacity }}
@@ -122,9 +114,13 @@ export default { } } }, - methods: {}, - created () { + methods: { + }, + created () { + setInterval(() => { + console.log(this.plane.planeState) + }, 2000) } } diff --git a/src/views/layout/index.vue b/src/views/layout/index.vue index 0580459..2fd1987 100644 --- a/src/views/layout/index.vue +++ b/src/views/layout/index.vue @@ -88,8 +88,8 @@ export default { // 更新mqtt信息 选择性更新状态 for (const key in jsonData) { if (key === 'heartBeat') { - // 每次接收到心跳 heartRandom属性 创建一个随机数 用于watch监听 - plane.planeState.heartRandom = Math.random() + plane.planeState.heartRandom = Math.random()// 每次接收到心跳 heartRandom属性 创建一个随机数 用于watch监听 + plane.planeState[key] = jsonData[key] // 按订阅信息 刷新飞机状态 } else if (key === 'position') { // 如果是飞机位置信息 则不是直接刷新状态 而是累计 到数组 以便于画出飞机路径 const position = JSON.parse(jsonData.position)