# 场景:运营后台只能一页页翻,没有批量导出
# Step 1: F12 → Network → 筛选 XHR
发现真实接口:
GET /api/v1/orders?status=paid&page=1&size=20
# Step 2: 改参数,一次拿完
fetch('/api/v1/orders?status=paid&page=1&size=999')
.then(r => r.json())
.then(data => console.log(data.list.length))
> 847 条数据,到手 ✓
# Step 3: 写个导出函数
function exportCSV(rows) {
const header = '工单号,工单日期,工单内容,状态';
const csv = [header, ...rows.map(r =>
`${r.id},${r.customer},${r.amount}`
)].join('\n');
// 生成文件 → 触发下载
}
# Step 4: 封装为浏览器插件 → 一键导出
✓ chrome-extension://xxx/popup.html
✓ 点击图标 → "导出订单" → 完成
⏱ 耗时:3秒(原来约15分钟)