Table 表格
WebH5
数据表格。支持自定义列、本地排序、斑马纹、竖向边框、行多选、加载遮罩与空态,移动端自动横向滚动。
何时使用
展示结构化列表数据,需要排序、选择或自定义单元格内容时;行数极大(万级)时开启 virtual 虚拟滚动。
何时不使用
virtual 模式下不支持 expandable 展开行(可变行高与窗口化冲突),同时设置时 console.warn 并忽略 expandable;virtual 必须配合 maxHeight,否则不生效;行高必须固定(由 size 决定),单元格内容不可撑高行。树形数据(treeProps)与 expandable 互斥(console.warn 后忽略 expandable),与 virtual 冲突时 virtual 优先、树形忽略;树形模式排序只作用于顶层行,子行跟随父行。简单图文列表用 Card/Stack 更轻。
Props
| 名称 | 类型 | 默认值 | 说明 |
|---|---|---|---|
columns | TableColumn[] | - | 列配置:{ key, title, width?, align?: 'left'|'center'|'right', sortable?: boolean | 'custom'(服务端排序只 emit 不本地排), fixed?: 'left'|'right', filters?: { label, value }[], filterMultiple?: boolean };固定列必须指定 width;配置 filters 后列头出现筛选图标 |
data | object[] | "[]" | 行数据,每行为对象,字段名对应 columns.key |
loading | boolean | false | 加载中,表体区域显示半透明遮罩与旋转圆弧 |
stripe | boolean | false | 斑马纹,间隔行使用弱化底色 |
border | boolean | false | 显示竖向边框 |
size | string:'sm' | 'md' | 'lg' | "md" | 尺寸,行高分别为 40 / 48 / 56 |
selectable | boolean | false | 首列渲染多选框,表头为全选(支持半选态);树形/虚拟等组合见下方说明 |
selectedKeys | array | "[]" | 已选行键数组,对应 v-model:selectedKeys |
rowKey | string | "id" | 行唯一键字段名 |
emptyText | string | - | 空态文案,默认取语言包 table.empty(zh-CN 为「暂无数据」),显式传入优先 |
maxHeight | number | string | - | 表体最大高度(数字按 px 计),超出后表体纵向滚动且表头 sticky 固定 |
expandable | boolean | false | 可展开行,首列渲染展开箭头(在多选框列左侧),展开状态内部管理,内容用 expand 插槽 |
expandedRowKeys | array | "undefined" | 受控展开行键数组,对应 v-model:expandedRowKeys;不传则内部管理 |
virtual | boolean | false | 虚拟滚动:表体只渲染可视窗口行(上下各 5 行 overscan),需配合 maxHeight 使用;行高取 size 固定值(sm 40 / md 48 / lg 56),万级数据可流畅渲染 |
showSummary | boolean | false | 合计行:固定在表体底部(弱化底色 + 中等字重 + 顶部 1px 分隔线);未传 summary 时数值列自动求和(该列全部为 number 或可转 number 的字符串才求和,保留原最大小数位),首个非数值列显示「合计」(语言包 table.summary) |
summary | string[] | - | 自定义合计行内容:每列一个字符串直接渲染(简单模式),传入后覆盖自动求和 |
treeProps | { children?: string } | - | 树形数据:传入即开启树形模式,children 指定子级字段名(默认 'children')。首列出现缩进(每层 16px)与展开箭头,默认全部展开,点击箭头收起/展开子树(按 rowKey 内部管理);排序只作用于顶层行,子行跟随父行 |
Events
| 名称 | 载荷 | 说明 |
|---|---|---|
update:selectedKeys | (string | number)[] | 选择变化时触发,配合 v-model:selectedKeys |
update:expandedRowKeys | (string | number)[] | 受控展开行变化,配合 v-model:expandedRowKeys |
select | (string | number)[] | 选择变化时触发,参数为最新键数组 |
sort | { key: string; order: 'asc' | 'desc' | null } | 点击 sortable 列头时触发,顺序循环 asc → desc → null |
filter-change | { key: string; values: unknown[] } | 筛选面板点击确定/重置后触发,values 为该列当前生效的选中值(重置为空数组) |
row-click | (row: object, index: number) | 点击行时触发;点击行首 checkbox 不触发 |
Slots
| 名称 | 说明 |
|---|---|
<column.key> | 动态具名插槽自定义单元格,scope { row, index, value } |
expand | 展开行内容(需开启 expandable),渲染为跨整行宽的内嵌区域,scope { row, index } |
empty | 自定义空态内容 |
示例
基础用法
示例加载中…
<Table
:columns="[
{ key: 'name', title: '姓名', width: 100 },
{ key: 'dept', title: '部门', width: 140 },
{ key: 'role', title: '岗位' },
]"
:data="[
{ id: 1, name: '林晓雨', dept: '研发中心', role: '高级前端工程师' },
{ id: 2, name: '陈志远', dept: '研发中心', role: '后端架构师' },
{ id: 3, name: '苏婉婷', dept: '产品设计部', role: '资深 UI 设计师' },
{ id: 4, name: '赵启铭', dept: '市场运营部', role: '运营主管' },
]"
/>固定列(左右固定)
示例加载中…
<Table
:columns="[
{ key: 'orderNo', title: '订单号', width: 160, fixed: 'left' },
{ key: 'customer', title: '客户', width: 180 },
{ key: 'product', title: '商品名称', width: 200 },
{ key: 'quantity', title: '数量', width: 70, align: 'center' },
{ key: 'unitPrice', title: '单价(元)', width: 100, align: 'right' },
{ key: 'amount', title: '金额(元)', width: 110, align: 'right', sortable: true },
{ key: 'status', title: '状态', width: 90 },
{ key: 'createdAt', title: '下单时间', width: 160 },
{ key: 'actions', title: '操作', width: 100, fixed: 'right', align: 'center' },
]"
size="sm"
:data="[
{ id: 1, orderNo: 'SO20260811001', customer: '杭州云栖科技有限公司', product: '工业级 3D 打印机 Pro Max', quantity: 2, unitPrice: 12800, amount: 25600, status: '待发货', createdAt: '2026-08-11 09:24' },
{ id: 2, orderNo: 'SO20260811002', customer: '上海晨星贸易有限公司', product: '智能温控物流周转箱', quantity: 50, unitPrice: 73.6, amount: 3680, status: '已支付', createdAt: '2026-08-11 10:02' },
{ id: 3, orderNo: 'SO20260810014', customer: '北京远山文创工作室', product: '手绘板 24 寸 4K', quantity: 1, unitPrice: 964, amount: 964, status: '已完成', createdAt: '2026-08-10 16:47' },
{ id: 4, orderNo: 'SO20260810009', customer: '深圳蓝鲸网络科技', product: 'GPU 服务器集群节点', quantity: 8, unitPrice: 3249.9, amount: 25999.2, status: '已完成', createdAt: '2026-08-10 11:15' },
]"
>
<template #status="{ value }">
<Tag :variant="value === '已完成' ? 'success' : value === '待发货' ? 'warning' : 'primary'">{{ value }}</Tag>
</template>
<template #actions>
<Stack :gap="8" direction="row">
<Link variant="primary" @click.stop>查看</Link>
<Link variant="danger" @click.stop>删除</Link>
</Stack>
</template>
</Table>固定头滚动
示例加载中…
<Table
:max-height="264"
:columns="[
{ key: 'orderNo', title: '订单号', width: 160 },
{ key: 'customer', title: '客户' },
{ key: 'amount', title: '金额(元)', width: 110, align: 'right' },
{ key: 'status', title: '状态', width: 90, align: 'center' },
]"
size="sm"
:data="[
{ id: 1, orderNo: 'SO20260811001', customer: '杭州云栖科技有限公司', amount: 25600, status: '待发货' },
{ id: 2, orderNo: 'SO20260811002', customer: '上海晨星贸易有限公司', amount: 3680, status: '已支付' },
{ id: 3, orderNo: 'SO20260810014', customer: '北京远山文创工作室', amount: 964, status: '已完成' },
{ id: 4, orderNo: 'SO20260810009', customer: '深圳蓝鲸网络科技', amount: 25999.2, status: '已完成' },
{ id: 5, orderNo: 'SO20260810003', customer: '广州白云餐饮集团', amount: 1120.5, status: '已完成' },
{ id: 6, orderNo: 'SO20260809021', customer: '成都锦江酒店管理有限公司', amount: 7680, status: '已完成' },
{ id: 7, orderNo: 'SO20260809018', customer: '南京紫金出版传媒', amount: 2399, status: '已退款' },
{ id: 8, orderNo: 'SO20260809007', customer: '武汉长江光电股份', amount: 15400, status: '已完成' },
{ id: 9, orderNo: 'SO20260808030', customer: '苏州金鸡湖商业地产', amount: 890, status: '已完成' },
{ id: 10, orderNo: 'SO20260808022', customer: '重庆两江新区管委会', amount: 43200, status: '已完成' },
{ id: 11, orderNo: 'SO20260808011', customer: '西安曲江文旅集团', amount: 5280, status: '已完成' },
{ id: 12, orderNo: 'SO20260807056', customer: '天津滨海新区建设投资', amount: 19750, status: '已完成' },
]"
>
<template #status="{ value }">
<Tag :variant="value === '已完成' ? 'success' : value === '待发货' ? 'warning' : value === '已退款' ? 'danger' : 'primary'" size="sm">{{ value }}</Tag>
</template>
</Table>展开行详情
示例加载中…
<Table
expandable
:columns="[
{ key: 'orderNo', title: '订单号', width: 150 },
{ key: 'customer', title: '客户' },
{ key: 'amount', title: '金额(元)', width: 110, align: 'right' },
{ key: 'createdAt', title: '下单时间', width: 150 },
]"
size="sm"
:data="[
{ id: 1, orderNo: 'SO20260811001', customer: '杭州云栖科技有限公司', amount: 25600, createdAt: '2026-08-11 09:24', items: '工业级 3D 打印机 Pro Max × 2(单价 12800 元),含一年上门维保服务', remark: '客户要求 8 月 20 日前送达余杭仓' },
{ id: 2, orderNo: 'SO20260811002', customer: '上海晨星贸易有限公司', amount: 3680, createdAt: '2026-08-11 10:02', items: '智能温控物流周转箱 × 50(单价 73.6 元),蓝色标准款', remark: '分批发货,首批 20 只本周发出' },
{ id: 3, orderNo: 'SO20260810014', customer: '北京远山文创工作室', amount: 964, createdAt: '2026-08-10 16:47', items: '手绘板 24 寸 4K × 1,附赠防误触手套与笔尖套装', remark: '已签收,客户确认无误' },
]"
>
<template #expand="{ row }">
<div style="display:flex;flex-direction:column;gap:6px;">
<div><strong style="color:var(--rn-color-text);">商品明细:</strong>{{ row.items }}</div>
<div><strong style="color:var(--rn-color-text);">订单备注:</strong>{{ row.remark }}</div>
</div>
</template>
</Table>行高尺寸
示例加载中…
<Stack :gap="16">
<Table
size="sm"
:columns="[
{ key: 'name', title: '商品名称' },
{ key: 'price', title: '售价(元)', align: 'right', width: 110 },
{ key: 'stock', title: '库存', align: 'right', width: 80 },
]"
:data="[
{ id: 1, name: '无线降噪耳机 Pro', price: 899, stock: 128 },
{ id: 2, name: '机械键盘 Cherry 茶轴 87 键', price: 469, stock: 36 },
]"
/>
<Table
size="md"
:columns="[
{ key: 'name', title: '商品名称' },
{ key: 'price', title: '售价(元)', align: 'right', width: 110 },
{ key: 'stock', title: '库存', align: 'right', width: 80 },
]"
:data="[
{ id: 1, name: '无线降噪耳机 Pro', price: 899, stock: 128 },
{ id: 2, name: '机械键盘 Cherry 茶轴 87 键', price: 469, stock: 36 },
]"
/>
<Table
size="lg"
:columns="[
{ key: 'name', title: '商品名称' },
{ key: 'price', title: '售价(元)', align: 'right', width: 110 },
{ key: 'stock', title: '库存', align: 'right', width: 80 },
]"
:data="[
{ id: 1, name: '无线降噪耳机 Pro', price: 899, stock: 128 },
{ id: 2, name: '机械键盘 Cherry 茶轴 87 键', price: 469, stock: 36 },
]"
/>
</Stack>排序(含数值与中文)
示例加载中…
<Table
:columns="[
{ key: 'name', title: '商品名称', sortable: true },
{ key: 'category', title: '分类', width: 100 },
{ key: 'price', title: '售价(元)', width: 124, align: 'right', sortable: true },
{ key: 'sales', title: '月销量', width: 90, align: 'right', sortable: true },
{ key: 'rating', title: '评分', width: 80, align: 'center', sortable: true },
]"
:data="[
{ id: 1, name: '无线降噪耳机 Pro', category: '数码影音', price: 899, sales: 3847, rating: 4.9 },
{ id: 2, name: '机械键盘 Cherry 茶轴 87 键', category: '电脑外设', price: 469, sales: 1230, rating: 4.7 },
{ id: 3, name: '27 寸 4K 专业显示器', category: '电脑外设', price: 3299, sales: 562, rating: 4.8 },
{ id: 4, name: '便携式蓝牙音箱', category: '数码影音', price: 259, sales: 2810, rating: 4.5 },
{ id: 5, name: '人体工学椅 Pro', category: '办公家具', price: 1899, sales: 940, rating: 4.6 },
]"
/>列对齐方式
示例加载中…
<Table
:columns="[
{ key: 'rank', title: '排名', width: 64, align: 'center' },
{ key: 'name', title: '门店名称' },
{ key: 'manager', title: '店长', width: 100 },
{ key: 'revenue', title: '月营收(万元)', width: 130, align: 'right' },
{ key: 'growth', title: '同比增长', width: 100, align: 'right' },
]"
:data="[
{ id: 1, rank: 1, name: '杭州西湖银泰旗舰店', manager: '张明远', revenue: 286.5, growth: '+18.2%' },
{ id: 2, rank: 2, name: '上海陆家嘴正大广场店', manager: '李婉清', revenue: 241.3, growth: '+12.5%' },
{ id: 3, rank: 3, name: '深圳南山万象天地店', manager: '王启航', revenue: 198.7, growth: '+8.9%' },
]"
>
<template #rank="{ value }">
<span :style="{ fontWeight: value <= 3 ? 700 : 400, color: value === 1 ? 'var(--rn-color-primary)' : value === 2 ? 'var(--rn-color-text-secondary)' : 'inherit' }">{{ value }}</span>
</template>
</Table>多选(v-model + @select)
示例加载中…
<Stack :gap="16">
<Table
selectable
:selected-keys="s ?? []"
@update:selected-keys="s = $event"
:columns="[
{ key: 'name', title: '姓名', width: 110 },
{ key: 'dept', title: '部门', width: 140 },
{ key: 'role', title: '岗位' },
]"
:data="[
{ id: 1, name: '林晓雨', dept: '研发中心', role: '前端工程师' },
{ id: 2, name: '陈志远', dept: '研发中心', role: '后端工程师' },
{ id: 3, name: '苏婉婷', dept: '产品设计部', role: 'UI 设计师' },
{ id: 4, name: '赵启铭', dept: '市场运营部', role: '运营专员' },
]"
/>
<Table
selectable
:selected-keys="s2 ?? []"
@update:selected-keys="s2 = $event"
:columns="[
{ key: 'item', title: '项目', width: 200 },
{ key: 'price', title: '单价(元)', width: 110, align: 'right' },
{ key: 'qty', title: '数量', width: 70, align: 'center' },
{ key: 'subtotal', title: '小计(元)', width: 110, align: 'right' },
]"
:data="[
{ id: 1, item: '品牌 VI 升级设计', price: 15000, qty: 1, subtotal: 15000 },
{ id: 2, item: '企业官网重构(含移动端)', price: 28000, qty: 1, subtotal: 28000 },
{ id: 3, item: '运营后台数据看板', price: 12000, qty: 2, subtotal: 24000 },
]"
/>
</Stack>斑马纹与竖向边框
示例加载中…
<Stack :gap="16">
<Table
stripe
:columns="[
{ key: 'name', title: '姓名', width: 110 },
{ key: 'dept', title: '部门', width: 140 },
{ key: 'role', title: '岗位' },
]"
:data="[
{ id: 1, name: '林晓雨', dept: '研发中心', role: '前端工程师' },
{ id: 2, name: '陈志远', dept: '研发中心', role: '后端工程师' },
{ id: 3, name: '苏婉婷', dept: '产品设计部', role: 'UI 设计师' },
{ id: 4, name: '赵启铭', dept: '市场运营部', role: '运营专员' },
{ id: 5, name: '周明轩', dept: '研发中心', role: '测试工程师' },
]"
/>
<Table
border
:columns="[
{ key: 'name', title: '商品', width: 180 },
{ key: 'spec', title: '规格', width: 180 },
{ key: 'price', title: '单价(元)', width: 110, align: 'right' },
{ key: 'stock', title: '库存', width: 80, align: 'right' },
]"
:data="[
{ id: 1, name: '无线降噪耳机 Pro', spec: '夜幕黑 / ANC 主动降噪', price: 899, stock: 128 },
{ id: 2, name: '机械键盘 87 键', spec: 'Cherry 茶轴 / PBT 键帽', price: 469, stock: 36 },
{ id: 3, name: '27 寸 4K 显示器', spec: 'IPS / Type-C 65W / HDR400', price: 2399, stock: 15 },
]"
/>
</Stack>行点击事件
示例加载中…
<Table
:columns="[
{ key: 'name', title: '任务名称' },
{ key: 'assignee', title: '负责人', width: 100 },
{ key: 'deadline', title: '截止日期', width: 120 },
{ key: 'priority', title: '优先级', width: 90, align: 'center' },
]"
:data="[
{ id: 1, name: '用户中心改版方案评审', assignee: '林晓雨', deadline: '2026-08-15', priority: '高' },
{ id: 2, name: '订单接口性能优化', assignee: '陈志远', deadline: '2026-08-18', priority: '高' },
{ id: 3, name: '运营活动落地页开发', assignee: '苏婉婷', deadline: '2026-08-20', priority: '中' },
{ id: 4, name: '周报模板更新', assignee: '赵启铭', deadline: '2026-08-22', priority: '低' },
]"
@row-click="(row) => console.log('打开:', row.name)"
>
<template #priority="{ value }">
<Tag :variant="value === '高' ? 'danger' : value === '中' ? 'warning' : 'default'" size="sm">{{ value }}</Tag>
</template>
</Table>加载、空态(文本 + 自定义插槽)
示例加载中…
<Stack :gap="16">
<Table
loading
:columns="[{ key: 'name', title: '商品' }, { key: 'stock', title: '库存' }]"
:data="[{ id: 1, name: '无线降噪耳机', stock: 326 }, { id: 2, name: '机械键盘 87 键', stock: 58 }]"
/>
<Table
:columns="[{ key: 'name', title: '商品' }, { key: 'stock', title: '库存' }]"
:data="[]"
empty-text="没有找到相关商品"
/>
<Table
:columns="[{ key: 'name', title: '商品' }, { key: 'stock', title: '库存' }]"
:data="[]"
>
<template #empty>
<div style="padding:24px;text-align:center;">
<div style="font-size:32px;margin-bottom:8px;">📭</div>
<div style="color:var(--rn-color-text-secondary);font-size:13px;">暂无商品记录,<a style="color:var(--rn-color-primary);cursor:pointer;">去新建</a></div>
</div>
</template>
</Table>
</Stack>虚拟滚动(1 万行)
示例加载中…
<Table
virtual
stripe
:max-height="384"
size="md"
:columns="[
{ key: 'orderNo', title: '订单号', width: 130 },
{ key: 'customer', title: '客户' },
{ key: 'product', title: '商品名称', width: 160 },
{ key: 'amount', title: '金额(元)', width: 100, align: 'right', sortable: true },
{ key: 'status', title: '状态', width: 80, align: 'center' },
]"
:data="Array.from({ length: 10000 }, (_, i) => ({
id: i + 1,
orderNo: `SO2026${String(100000 + i)}`,
customer: ['杭州云栖科技有限公司', '上海晨星贸易有限公司', '北京远山文创工作室', '深圳蓝鲸网络科技', '广州白云餐饮集团'][i % 5],
product: ['工业级 3D 打印机 Pro Max', '智能温控物流周转箱', '手绘板 24 寸 4K', 'GPU 服务器集群节点'][i % 4],
amount: Math.round(((i * 7919) % 50000 + 99.5) * 100) / 100,
status: ['待发货', '已支付', '已完成', '已退款'][i % 4],
}))"
>
<template #status="{ value }">
<Tag :variant="value === '已完成' ? 'success' : value === '待发货' ? 'warning' : value === '已退款' ? 'danger' : 'primary'" size="sm">{{ value }}</Tag>
</template>
</Table>自定义列插槽 + 自定义行键
示例加载中…
<Table
:columns="[
{ key: 'avatar', title: '', width: 48, align: 'center' },
{ key: 'name', title: '员工', width: 100 },
{ key: 'dept', title: '部门', width: 130 },
{ key: 'level', title: '职级', width: 80, align: 'center' },
{ key: 'hireDate', title: '入职时间', width: 120 },
{ key: 'status', title: '状态', width: 90, align: 'center' },
]"
row-key="employeeNo"
:data="[
{ employeeNo: 'EMP001', name: '林晓雨', dept: '研发中心', level: 'P7', hireDate: '2020-03-16', status: '在职' },
{ employeeNo: 'EMP002', name: '陈志远', dept: '研发中心', level: 'P8', hireDate: '2019-07-01', status: '在职' },
{ employeeNo: 'EMP003', name: '苏婉婷', dept: '产品设计部', level: 'P6', hireDate: '2021-11-22', status: '试用' },
{ employeeNo: 'EMP004', name: '赵启铭', dept: '市场运营部', level: 'P5', hireDate: '2022-05-10', status: '在职' },
]"
>
<template #avatar="{ row }">
<div :style="{ width:'28px',height:'28px',borderRadius:'50%',background:`hsl(${row.employeeNo === 'EMP001' ? 220 : row.employeeNo === 'EMP002' ? 180 : row.employeeNo === 'EMP003' ? 340 : 40},55%,58%)`,display:'flex',alignItems:'center',justifyContent:'center',color:'#fff',fontSize:'11px',fontWeight:600 }">{{ row.name[0] }}</div>
</template>
<template #status="{ value }">
<Tag :variant="value === '在职' ? 'success' : 'warning'" size="sm">{{ value }}</Tag>
</template>
<template #level="{ value }">
<span :style="{ fontFamily:'monospace',fontWeight:600,color:value === 'P8' ? 'var(--rn-color-primary)' : 'inherit' }">{{ value }}</span>
</template>
</Table>列筛选
示例加载中…
<Table
:columns="[
{ key: 'orderNo', title: '订单号', width: 150 },
{ key: 'customer', title: '客户' },
{ key: 'amount', title: '金额(元)', width: 110, align: 'right', sortable: true },
{ key: 'status', title: '状态', width: 130, filters: [
{ label: '待发货', value: '待发货' },
{ label: '已支付', value: '已支付' },
{ label: '已完成', value: '已完成' },
{ label: '已退款', value: '已退款' },
] },
{ key: 'channel', title: '销售渠道', width: 130, filterMultiple: false, filters: [
{ label: '线上商城', value: '线上商城' },
{ label: '线下门店', value: '线下门店' },
{ label: '经销商', value: '经销商' },
] },
]"
size="sm"
:data="[
{ id: 1, orderNo: 'SO20260811001', customer: '杭州云栖科技有限公司', amount: 25600, status: '待发货', channel: '经销商' },
{ id: 2, orderNo: 'SO20260811002', customer: '上海晨星贸易有限公司', amount: 3680, status: '已支付', channel: '线上商城' },
{ id: 3, orderNo: 'SO20260810014', customer: '北京远山文创工作室', amount: 964, status: '已完成', channel: '线下门店' },
{ id: 4, orderNo: 'SO20260810009', customer: '深圳蓝鲸网络科技', amount: 25999.2, status: '已完成', channel: '经销商' },
{ id: 5, orderNo: 'SO20260810003', customer: '广州白云餐饮集团', amount: 1120.5, status: '已退款', channel: '线上商城' },
]"
@filter-change="({ key, values }) => console.log('筛选变化:', key, values)"
>
<template #status="{ value }">
<Tag :variant="value === '已完成' ? 'success' : value === '待发货' ? 'warning' : value === '已退款' ? 'danger' : 'primary'" size="sm">{{ value }}</Tag>
</template>
</Table>合计行
示例加载中…
<Stack :gap="16">
<Table
show-summary
:columns="[
{ key: 'dept', title: '部门', width: 160 },
{ key: 'headcount', title: '人数', width: 80, align: 'right' },
{ key: 'travel', title: '差旅费(元)', width: 120, align: 'right' },
{ key: 'office', title: '办公费(元)', width: 120, align: 'right' },
{ key: 'training', title: '培训费(元)', width: 120, align: 'right' },
]"
size="sm"
:data="[
{ id: 1, dept: '研发中心', headcount: 42, travel: 38600, office: 12450.5, training: 8000 },
{ id: 2, dept: '产品设计部', headcount: 18, travel: 21400, office: 8320, training: 5600.5 },
{ id: 3, dept: '市场运营部', headcount: 25, travel: 45200, office: 15680, training: 4200 },
{ id: 4, dept: '综合管理部', headcount: 12, travel: 9800, office: 22100.75, training: 3600 },
]"
/>
<Table
show-summary
:summary="['本季度费用合计', '97 人', '115000 元', '58551.25 元', '21400.5 元']"
:columns="[
{ key: 'dept', title: '部门', width: 160 },
{ key: 'headcount', title: '人数', width: 80, align: 'right' },
{ key: 'travel', title: '差旅费(元)', width: 120, align: 'right' },
{ key: 'office', title: '办公费(元)', width: 120, align: 'right' },
{ key: 'training', title: '培训费(元)', width: 120, align: 'right' },
]"
size="sm"
:data="[
{ id: 1, dept: '研发中心', headcount: 42, travel: 38600, office: 12450.5, training: 8000 },
{ id: 2, dept: '产品设计部', headcount: 18, travel: 21400, office: 8320, training: 5600.5 },
{ id: 3, dept: '市场运营部', headcount: 25, travel: 45200, office: 15680, training: 4200 },
{ id: 4, dept: '综合管理部', headcount: 12, travel: 9800, office: 22100.75, training: 3600 },
]"
/>
</Stack>树形数据
示例加载中…
<Table
:tree-props="{ children: 'children' }"
:columns="[
{ key: 'org', title: '组织 / 团队', width: 240 },
{ key: 'owner', title: '负责人', width: 100 },
{ key: 'budget', title: '年度预算(万元)', width: 140, align: 'right', sortable: true },
{ key: 'used', title: '已执行(万元)', width: 130, align: 'right' },
]"
size="sm"
:data="[
{ id: 1, org: '研发中心', owner: '陈志远', budget: 1200, used: 786.5, children: [
{ id: 11, org: '平台架构组', owner: '何志军', budget: 420, used: 301.2 },
{ id: 12, org: '前端体验组', owner: '林晓雨', budget: 380, used: 245.8, children: [
{ id: 121, org: '设计系统小组', owner: '苏婉婷', budget: 150, used: 98.4 },
] },
{ id: 13, org: '质量保障组', owner: '周明轩', budget: 400, used: 239.5 },
] },
{ id: 2, org: '市场运营部', owner: '赵启铭', budget: 860, used: 512.3, children: [
{ id: 21, org: '品牌传播组', owner: '孙雅琪', budget: 360, used: 201.7 },
{ id: 22, org: '增长投放组', owner: '吴海涛', budget: 500, used: 310.6 },
] },
]"
/>Playground
加载中…
md
跨端版本
该组件同时提供 uni-app / uni-app X 实现(H5 / 微信小程序 / App),API 可能略有差异,见 uni-app 端 Table 文档(含手机预览)。