🏗️ 容器内表格导出

支持 Ant Design、Element UI 等 UI 框架的表格结构 —— ID 可以在容器元素上,自动查找内部的 <table>

场景1: ID 在容器元素上(Ant Design 风格)

ID "antd-table" 设置在外层 <section> 上,库会自动在其内部查找 <table> 元素。

Name Age Address Tags
John Brown 32 New York No. 1 Lake Park NICE DEVELOPER
Jim Green 42 London No. 1 Lake Park LOSER
Joe Black 32 Sydney No. 1 Lake Park COOL TEACHER

场景2: ID 在 div 容器上

ID "wrapper-table" 设置在外层 <div> 上,同样自动查找内部表格。

产品 价格 库存 状态
MacBook Pro 16" ¥18,999 56 在售
iPhone 15 Pro ¥8,999 128 在售
AirPods Max ¥4,399 0 缺货

💡 代码示例

// ID 在容器上(如 Ant Design 的 section/div),自动查找内部 table
import { export_table, ExportFormat } from './pkg/belobog_stellar_grid.js';

// 无需关心 table 是否有 id,只需传入容器的 id
export_table('antd-table', '用户列表.csv');
export_table('wrapper-table', '产品列表', ExportFormat.Xlsx);