iter: d16 dataTable 落地列宽 width

This commit is contained in:
ui-arch-bot
2026-10-23 16:58:52 +08:00
parent 1c03c8113a
commit fa168b9a1c
7 changed files with 35 additions and 15 deletions
+9 -1
View File
@@ -132,6 +132,14 @@ export function dataTable<T extends { id: RowKey }>(props: DataTableProps<T>): H
});
});
// —— 列宽:数字落成 <col> 固定宽度,'flex' 或未设置交给浏览器自适应 ——
const colgroup = h(
'colgroup',
null,
selectable ? h('col', { style: 'width:44px' }) : null,
...props.columns.map((col) => (typeof col.width === 'number' ? h('col', { style: `width:${col.width}px` }) : h('col'))),
);
const filterInput = textField({
placeholder: `筛选 ${filterKey}…`,
disabled: props.loading, // 加载中禁止筛选,避免与在途结果竞争
@@ -150,7 +158,7 @@ export function dataTable<T extends { id: RowKey }>(props: DataTableProps<T>): H
filterInput,
selectable ? h('span', { class: 'ua-sel-count' }, () => (selectedCount() ? `已选 ${selectedCount()} 行` : '')) : null,
),
h('div', { class: 'ua-table-scroll' }, h('table', null, h('thead', null, h('tr', null, selectable ? headCheck : null, ...props.columns.map(th))), tbody)),
h('div', { class: 'ua-table-scroll' }, h('table', null, colgroup, h('thead', null, h('tr', null, selectable ? headCheck : null, ...props.columns.map(th))), tbody)),
h(
'div',
{ class: 'ua-pager' },