mirror of
https://github.com/501351981/vue-office.git
synced 2025-06-15 07:00:00 +08:00
Merge pull request #127 from RedFlagRF/master
修复PDF懒加载判断错误导致渲染多余不存在canvas问题
This commit is contained in:
commit
eda8ab8283
@ -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