表格分组递归

This commit is contained in:
仲么了
2024-03-12 11:03:58 +08:00
parent b393419b0a
commit 3ba3016135
8 changed files with 271 additions and 36 deletions

View File

@@ -0,0 +1,41 @@
<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>