dataease/frontend/src/components/gridTable/tableBody.vue

26 lines
540 B
Vue
Raw Normal View History

<script>
export default {
2022-10-11 15:09:32 +08:00
name: 'TableBody',
functional: true,
props: {
columns: {
type: Array,
2022-10-11 15:09:32 +08:00
default: () => []
}
},
render(h, context) {
2022-10-11 15:09:32 +08:00
const nodes = []
const { columns } = context.props
const { children = [] } = context
if (!columns?.length) return children
2022-08-22 17:54:31 +08:00
children.forEach((ele) => {
2022-10-11 15:09:32 +08:00
const { prop, type } = ele.componentOptions?.propsData || {}
if (columns.includes(prop) || type === 'selection') {
nodes.push(ele)
2022-08-22 17:54:31 +08:00
}
2022-10-11 15:09:32 +08:00
})
return nodes
}
}
</script>