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)