<template>
  <div>
    <slot name="header"></slot>
    <!-- 动态列 -->
    <template v-for="column in columnOption">
      <column-dynamic
        v-if="column.children && column.children.length > 0"
        :columnOption="column"
        :key="column.label"
      ></column-dynamic>
      <column-slot v-else :column="column" :column-option="columnOption" :key="column.id">
        <template v-for="item in comTable.mainSlot" slot-scope="scope" :slot="item">
          <slot v-bind="scope" :name="item"></slot>
        </template>
      </column-slot>
    </template>
    <slot name="footer"></slot>
  </div>
</template>

<script>
import columnDynamic from './column-dynamic';
import columnSlot from './column-slot';
export default {
  name: 'comTable',
  data() {
    return {};
  },
  components: {
    columnSlot,
    columnDynamic,
  },
  inject: ['comTable'],
  props: {
    columnOption: Array,
  },
  computed: {},
  methods: {},
};
</script>
