<template>
    <template v-for="(item, index) in props.column" :key="index + '-column'">
        <vxe-table-colgroup
            v-if="item.children"
            :field="item.field"
            :title="item.title"
            :min-width="item.width"
            show-overflow
            align="center"
        >
            <!-- 递归调用 -->
            <GroupColumn :column="item.children" />
        </vxe-table-colgroup>
        <Column :attr="item" :tree-node="item.treeNode" v-else>
            <template v-if="item.render" #default="scope">
                <FieldRender
                    :field="item"
                    :row="scope.row"
                    :column="scope.column"
                    :index="scope.rowIndex"
                    :key="
                        index +
                        '-' +
                        item.render +
                        '-' +
                        (item.field ? '-' + item.field + '-' + scope.row[item.field] : '')
                    "
                />
            </template>
        </Column>
    </template>
</template>

<script setup lang="ts">
import FieldRender from '@/components/table/fieldRender/index.vue'
import Column from '@/components/table/column/index.vue'

const props = defineProps<{
    column: any[]
}>()
</script>
