From e790ed9c187c4aa7144801b9f0b52af6dc6bfaa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=BF=BD=E9=80=90=E8=80=85?= <48118178+RedFlagRF@users.noreply.github.com> Date: Thu, 24 Aug 2023 12:13:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DPDF=E7=BB=84=E4=BB=B6?= =?UTF-8?q?=E5=9C=A8PDF=E9=A1=B5=E9=9D=A2=E8=B6=85=E8=BF=87=E9=BB=98?= =?UTF-8?q?=E8=AE=A4=E6=87=92=E5=8A=A0=E8=BD=BD=E9=A1=B5=E6=95=B0=E6=97=B6?= =?UTF-8?q?=E3=80=82=E5=9C=A8=E6=BB=9A=E5=8A=A8=E9=A1=B5=E9=9D=A2=E6=97=B6?= =?UTF-8?q?=EF=BC=8C=E7=94=B1=E4=BA=8E=E5=88=A4=E6=96=AD=E9=94=99=E8=AF=AF?= =?UTF-8?q?=EF=BC=8C=E5=AF=BC=E8=87=B4=E8=AE=A1=E7=AE=97numPages=20?= =?UTF-8?q?=E5=80=BC=E6=AF=94=E5=AE=9E=E9=99=85=E9=A1=B5=E6=95=B0=E5=A4=A7?= =?UTF-8?q?=EF=BC=8C=E4=B8=94=E6=9C=AA=E7=BB=8F=E5=88=A4=E6=96=AD=EF=BC=8C?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E6=B8=B2=E6=9F=93=E6=96=B0=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E3=80=82=E4=BD=BF=E5=BE=97=E6=B8=B2=E6=9F=93?= =?UTF-8?q?=E5=90=8E=E7=9A=84=E9=A1=B5=E9=9D=A2=E5=87=BA=E7=8E=B0=E4=BA=86?= =?UTF-8?q?=E4=BB=80=E4=B9=88=E9=83=BD=E6=B2=A1=E6=9C=89canvas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/packages/vue-pdf/src/main.vue | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/core/packages/vue-pdf/src/main.vue b/core/packages/vue-pdf/src/main.vue index e08287a..211c892 100644 --- a/core/packages/vue-pdf/src/main.vue +++ b/core/packages/vue-pdf/src/main.vue @@ -78,11 +78,14 @@ export default defineComponent({ function onScrollPdf(e) { const { scrollTop, scrollHeight, clientHeight } = e.target; if (scrollTop + clientHeight >= scrollHeight) { - if (numPages.value < pdfDocument.numPages) { - let oldNum = numPages.value; - numPages.value += Math.min(lazySize, pdfDocument.numPages); - renderPage(oldNum+1); - } + if (numPages.value >= pdfDocument.numPages) { + return; + } + let oldNum = numPages.value; + numPages.value = Math.min(pdfDocument.numPages, oldNum + lazySize); + if (numPages.value > oldNum) { + renderPage(oldNum + 1); + } } }