<script lang='ts'>
import { defineComponent, createVNode, reactive } from 'vue'
import { Column } from 'vxe-table'
import { uuid } from '@/utils/random'

export default defineComponent({
    name: 'Column',
    props: {
        attr: {
            type: Object,
            required: true
        }
    },
    setup(props, { slots }) {
        const attr = reactive(props.attr)
        attr['align'] = attr['align'] ? attr['align'] : 'center'
        attr['column-key'] = attr['column-key'] ? attr['column-key'] : attr.prop || uuid()
        return () => {
            return createVNode(Column, attr, slots.default)
        }
    }
})
</script>
