| | |
| | | :label="item.label" |
| | | :prop="item.prop" |
| | | :show-overflow-tooltip="item.dataType === 'action' || item.dataType === 'slot' ? false : true" |
| | | :min-width="columnWidth(item)" |
| | | :min-width="columnMinWidth(item)" |
| | | :sortable="item.sortable ? true : false" |
| | | :type="item.type" |
| | | :width="columnWidth(item)" |
| | |
| | | }) |
| | | |
| | | function columnWidth(item) { |
| | | if (item.minWidth) return undefined |
| | | return item.dataType === 'action' ? actionColumnWidth.value : item.width |
| | | } |
| | | |
| | | // 配置 minWidth 时只约束最小宽度,把剩余空间交给 Element Plus 自动分配。 |
| | | // 未配置 minWidth 的旧页面继续沿用原有固定 width 行为。 |
| | | function columnMinWidth(item) { |
| | | if (item.minWidth) return item.minWidth |
| | | return item.dataType === 'action' ? actionColumnWidth.value : item.width |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | function indexMethod(index) { |
| | | return (props.page.current - 1) * props.page.size + index + 1 |
| | | // 未传 page 时默认 current 为 0,会算出 -9、-8 这类负序号;这里兜底为第一页 |
| | | const current = props.page && props.page.current > 0 ? props.page.current : 1 |
| | | const size = props.page && props.page.size > 0 ? props.page.size : 10 |
| | | return (current - 1) * size + index + 1 |
| | | } |
| | | |
| | | function onPagination({ page, limit }) { |