mirror of
https://github.com/501351981/vue-office.git
synced 2025-07-25 07:41:42 +08:00
fix: 修复PDF组件在PDF页面超过默认懒加载页数时。在滚动页面时,由于判断错误,导致计算numPages 值比实际页数大,且未经判断,直接渲染新页面导致。使得渲染后的页面出现了什么都没有canvas
This commit is contained in:
parent
ab3f8bb444
commit
e790ed9c18
@ -78,11 +78,14 @@ export default defineComponent({
|
|||||||
function onScrollPdf(e) {
|
function onScrollPdf(e) {
|
||||||
const { scrollTop, scrollHeight, clientHeight } = e.target;
|
const { scrollTop, scrollHeight, clientHeight } = e.target;
|
||||||
if (scrollTop + clientHeight >= scrollHeight) {
|
if (scrollTop + clientHeight >= scrollHeight) {
|
||||||
if (numPages.value < pdfDocument.numPages) {
|
if (numPages.value >= pdfDocument.numPages) {
|
||||||
let oldNum = numPages.value;
|
return;
|
||||||
numPages.value += Math.min(lazySize, pdfDocument.numPages);
|
}
|
||||||
renderPage(oldNum+1);
|
let oldNum = numPages.value;
|
||||||
}
|
numPages.value = Math.min(pdfDocument.numPages, oldNum + lazySize);
|
||||||
|
if (numPages.value > oldNum) {
|
||||||
|
renderPage(oldNum + 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user