riku
2025-09-01 b33e28bc2843555355ecad59a80c83e3c26445a3
src/components/monitor/VehicleData.vue
@@ -1,11 +1,25 @@
<template>
  <el-row class="wrap">
    <el-form :inline="true">
  <el-row justify="start" class="wrap">
    <!-- <el-space direction="vertical" :size="0">
      <el-icon size="30"><Stopwatch /></el-icon>
      <el-text class="speed-text">SPD</el-text>
    </el-space>
    <div>
      <el-text class="speed-number">{{ speed }}</el-text>
      <el-text class="speed-unit"><sub>km/h</sub></el-text>
    </div> -->
    <FactorIconText
      elIcon="Odometer"
      label="SPD"
      :value="speed"
      unit="km/h"
    ></FactorIconText>
    <!-- <el-form :inline="true">
      <el-form-item label="车速:" class="tag-2">
        {{ speed }}
        {{ speed }}km/h
      </el-form-item>
    </el-form>
    <GaugeChart name="车速" :speed="speed"></GaugeChart>
    </el-form> -->
    <!-- <GaugeChart name="车速" :value="speed"></GaugeChart> -->
  </el-row>
</template>
<script>
@@ -14,17 +28,21 @@
export default {
  props: {
    loading: Boolean,
    factorDatas: FactorDatas
    factorDatas: FactorDatas,
    speed: {
      type: Number,
      default: 0
    }
  },
  data() {
    return {
      speed: '--km/h'
      // speed: 0
    };
  },
  watch: {
    factorDatas: {
      handler(nV) {
        this.speed = this.lastOne(nV, '14') + 'km/h';
        // this.speed = this.lastOne(nV, '14');
      },
      deep: true
    }
@@ -36,9 +54,15 @@
        const lastIndex = f.datas.length - 1;
        return factorDatas.factor[key].datas[lastIndex].factorData;
      } else {
        return '--';
        return 0;
      }
    }
  }
};
</script>
<style scoped>
.wrap {
  /* flex-direction: column; */
  /* background-color: antiquewhite; */
}
</style>