Skip to content

Commit 51eee05

Browse files
committed
refactor: 重构 url data 变量逻辑
1 parent 9b8467f commit 51eee05

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/components/BootstrapBlazor.PdfReader/PdfReader.razor.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ export async function setUrl(id, url) {
3636

3737
const { options } = pdf;
3838
options.url = url;
39+
options.data = null;
3940
await loadPdf(pdf);
4041
}
4142

@@ -48,8 +49,8 @@ export async function setData(id, data) {
4849
}
4950

5051
const { options } = pdf;
51-
options.url = objectUrl;
52-
options.data = null;
52+
options.url = null;
53+
options.data = data;;
5354
await loadPdf(pdf);
5455
}
5556

@@ -178,7 +179,10 @@ const disposePdf = pdf => {
178179
const viewContainer = el.querySelector(".bb-view-container");
179180
if (viewContainer) {
180181
[...viewContainer.children].forEach(i => {
181-
if (!i.classList.contains("pdfViewer")) {
182+
if (i.classList.contains("pdfViewer")) {
183+
i.innerHTML = "";
184+
}
185+
else {
182186
i.remove();
183187
}
184188
})

0 commit comments

Comments
 (0)