useTableRowIndex
@astryxdesign/core v0.7.1 · useTableRowIndex
使用方法
返回一个 TablePlugin,在表格最前面加一列右对齐、等宽的序号。序号跟着当前渲染的数据顺序走(排序、过滤、分页之后的结果),默认从 1 开始。renderCell 只拿到一行数据,所以插件需要你传入当前渲染的数据数组,用它算出每一行的序号。
ts
import { useTableRowIndex } from '@astryx-vue/core/Table'示例
useTableRowIndex —— 行号列
# | Title | Artist | Plays |
|---|---|---|---|
| 1 | Nightfall | Ava Chen | 1820 |
| 2 | Ember | Liam Park | 942 |
| 3 | Tidal | Zoe Vega | 3310 |
| 4 | Cinder | Max Ross | 604 |
| 5 | Halcyon | Mia Cole | 2075 |
在最前面加了一列序号的表格。序号是等宽字体、右对齐,顺序跟着渲染后的数据。