StationData.vue 1.15 KB
<template>
  <div class="station-data">
    <el-table
      :data="tableData"
      :header-cell-style="{ background: '#eeeeee', color: '#333' }"
      height="250"
      border
      style="width: 100%"
      fit
    >
      <el-table-column prop="date" label="日期" width="180"> </el-table-column>
      <el-table-column prop="name" label="姓名" width="180"> </el-table-column>
      <el-table-column prop="address" label="地址"> </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { GetStationInfo } from "@/api/main";
export default {
  name: "StationData",

  data() {
    return {
      tableData: [],
    };
  },
  methods: {
    start() {
      this.timer = setInterval(() => {
        GetStationInfo().then((res) => {
          console.log("站台", res.data);
          if (res.code === "Success") {
            this.tableData = res.data;
          }
        });
      }, 3000);
    },
    stop() {
      clearInterval(this.timer);
      this.tableData = [];
    },
  },
  created() {},
  beforeDestroy() {
    clearInterval(this.timer);
  },
};
</script>

<style lang="scss" scoped>
.station-data {
  width: 100%;
  height: 100%;
}
</style>