HistoricalDataTree.vue 2.15 KB
<template>
  <div style="width: 100%;height: 100%" class="page-container">
    <div class="scroll-container">
      <el-scrollbar style="width:100%;height: 79vh">
        <el-tree v-if="historyData.length > 0" :data="historyData" class="historical-list-tree">
          <span class="custom-tree-node" style="width: 100%;border: 1px" slot-scope="{ node , data }">
            <history-data :data="data"></history-data>
          </span>
        </el-tree>
        <el-empty v-else></el-empty>
      </el-scrollbar>
    </div>
  </div>
</template>
<script>
import HistoryData from "../HistoryData.vue";

export default {
  name: 'historical-data',
  components: {HistoryData},
  props: {
    historyData: {
      type: Array,
      default: []
    }
  },
  //计算属性 类似于data概念",
  computed: {},
  //监控data中的数据变化",
  watch: {
  },
  //方法集合",
  methods: {
    //点击事件
    clickButton(data){
      this.$emit('click', data);
    }
  },
  //生命周期 - 创建完成(可以访问当前this实例)",
  created() {
  },
  //生命周期 - 挂载完成(可以访问DOM元素)",
  mounted() {

  },
  beforeCreate() {
  }, //生命周期 - 创建之前",
  beforeMount() {
  }, //生命周期 - 挂载之前",
  beforeUpdate() {
  }, //生命周期 - 更新之前",
  updated() {
  }, //生命周期 - 更新之后",
  beforeDestroy() {
  }, //生命周期 - 销毁之前",
  destroyed() {
  }, //生命周期 - 销毁完成",
  activated() {
  } //如果页面有keep-alive缓存功能,这个函数会触发",
};
</script>
<style scoped>

.page-container {
  display: flex;
  flex-direction: column;
  height: 100vh; /* 视口高度的 100% */
}
.box-card {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
}

.scroll-container {
  flex-grow: 1;
  overflow: hidden; /* 确保内容不会溢出 */
}
/* 菜单的样式 */
.rMenu li {
  width: 170px;
  list-style: none outside none;
  cursor: default;
  color: #666;
  margin-left: -20px;
}

.rMenu li:hover {
  color: #EEE;
  background-color: #666;
}
.historical-list-tree >>> .el-tree-node__content {
  padding: 15px;
  height: 20px;
}
.historical-list-tree {
 margin: 10px 0 20px 0;
}
</style>