[前端+RAG] 修复PDF ArrayBuffer detached;修复阅读模式右侧空白(覆盖PyMuPDF固定宽度)

This commit is contained in:
2026-04-02 14:30:58 +08:00
parent 379187f675
commit 7caf7cf66a
3 changed files with 11 additions and 5 deletions

View File

@@ -460,7 +460,11 @@ const loadPdfFile = async () => {
params: { fileId: selectedFile.value.fileId },
responseType: 'arraybuffer'
});
pdfData.value = resp.data;
// 复制 ArrayBuffer 避免被 Vue 响应式代理导致 detached
const src = resp.data as ArrayBuffer;
const copy = new ArrayBuffer(src.byteLength);
new Uint8Array(copy).set(new Uint8Array(src));
pdfData.value = copy;
} catch (e: any) {
pdfData.value = null;
docHtml.value = '<p style="color:#999;text-align:center;margin-top:40px;">PDF 文件加载失败</p>';