Skip to content

Commit

Permalink
fix(table): resolve column width on multiple columns
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeJim committed Dec 23, 2021
1 parent a529df1 commit 02898ac
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/table/base-table/col-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,23 @@ export default defineComponent({
methods: {
renderColgroup(): Array<VNode> {
const { columns } = this;
type ColumnType = typeof columns;
const colgroup: Array<VNode> = [];
columns.forEach((column) => {
const flatArray = (arr: ColumnType) => {
const res: ColumnType = [];
arr.forEach((item: any) => {
if (item?.children?.length > 0) {
const val = flatArray(item.children);
res.push(...val);
} else {
res.push(item);
}
});
return res;
};
const flatCols = flatArray(this.columns);

flatCols.forEach((column) => {
const { width, minWidth, colKey } = column;
const style: any = {};
if (width) {
Expand Down

0 comments on commit 02898ac

Please sign in to comment.