import { eventWithTime } from 'rrweb'; export const downloadHtml = (events: eventWithTime[]) => { if (events.length === 0) return; // 1. 构建 HTML 模板字符串 // 我们将 events 数据直接注入到 `; // 2. 创建 Blob 并下载 const blob = new Blob([htmlContent], { type: 'text/html' }); const url = URL.createObjectURL(blob); const a = document.createElement('a'); a.href = url; a.download = `replay-${Date.now()}.html`; // 保存为 .html 文件 document.body.appendChild(a); a.click(); document.body.removeChild(a); URL.revokeObjectURL(url); };