派生自 wuyushui/SewerAndRainNetwork

徐旺旺
2021-05-30 f8865d1c7f36c4ffa66002e0dd3a9d5e99e4fe6b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<template>
  <el-table :data="tableData" border :height="height">
    <template v-for="item in tableHeader">
      <table-column v-if="item.children && item.children.length" :key="item.id" :coloumn-header="item"></table-column>
      <el-table-column v-else :key="item.id" :label="item.label" :prop="item.prop" align="center"></el-table-column>
    </template>
  </el-table>
</template>
 
<script>
import TableColumn from './TableColumn'
export default {
  props: {
    // 表格的数据
    tableData: {
      type: Array,
      required: true
    },
    // 多级表头的数据
    tableHeader: {
      type: Array,
      required: true
    },
    // 表格的高度
    height: {
      type: String,
      default: '340'
    }
  },
  components: {
    TableColumn
  },
  watch: {
    tableData (val, oldVal) {
      this.tableData = val
    }
  }
}
</script>
 
<style scoped>
 
</style>