24 lines
657 B
JavaScript
24 lines
657 B
JavaScript
import { h, defineComponent } from 'vue';
|
|
import { Table } from '@hwork/ant-design-vue';
|
|
|
|
function patchColumns(cols) {
|
|
if (!Array.isArray(cols)) return cols;
|
|
return cols.map((col) => {
|
|
if (!col) return col;
|
|
const next = { ...col };
|
|
if (next.ellipsis === undefined) next.ellipsis = true;
|
|
if (Array.isArray(next.children)) next.children = patchColumns(next.children);
|
|
return next;
|
|
});
|
|
}
|
|
|
|
export default defineComponent({
|
|
name: 'ATable',
|
|
inheritAttrs: false,
|
|
setup(_, { attrs, slots }) {
|
|
const patchedColumns = patchColumns(attrs.columns);
|
|
return () => h(Table, { ...attrs, columns: patchedColumns }, slots);
|
|
},
|
|
});
|
|
|