de/frontend/src/components/gridTable/tableBody.vue
2022-08-22 18:14:04 +08:00

25 lines
551 B
Vue

<script>
export default {
name: "TableBody",
functional: true,
props: {
columns: {
type: Array,
default: () => [],
},
},
render(h, context) {
const nodes = [];
const { columns } = context.props;
const { children = [] } = context;
if (!columns?.length) return children;
children.forEach((ele) => {
const { prop, type } = ele.componentOptions?.propsData || {};
if (columns.includes(prop) || type === "selection") {
nodes.push(ele);
}
});
return nodes;
},
};
</script>