<template>
  <el-table-column
    :prop="col.prop"
    :label="col.label"
    :align="alignType"
  >
    <template v-for="(item, index) of col.children">
      <column-item v-if="item.children" :key="index" :col="item"></column-item>
      <el-table-column
        v-else
        :key="index"
        :label="item.label"
        :prop="item.prop"
        :align="alignType"
      ></el-table-column>
    </template>
  </el-table-column>
</template>

<script>
export default {
  name: 'ColumnItem',
  props: {
    col: {
      type: Object
    },
    // 判断单元格文字是居中还是左对齐显示
    alignType: {
      type: String,
      default: 'center'// 默认居中
    }
  }
}
</script>
<style scoped></style>
