diff --git a/src/components/PdfPreview/view.vue b/src/components/PdfPreview/view.vue index e62b3d3b..671f49e7 100644 --- a/src/components/PdfPreview/view.vue +++ b/src/components/PdfPreview/view.vue @@ -31,8 +31,9 @@ 0 / 0 {{ currentPage }} / {{ pageCount }} --> - 加载更多 - 加载中 + 加载更多 + 加载中 + 没有更多数据了 @@ -103,7 +104,6 @@ export default { // console.log(e,'loadProgress'); }, loadedPageHandle(e){ - console.log(e,'loadedPageHandle'); this.pdfpage = e; }, @@ -120,24 +120,16 @@ export default { }, //加载页面 loadInitPdf(url) { - if(url && url.indexOf('.pdf')>-1){ let loadingTask = pdf.createLoadingTask(url); this.src=loadingTask; - loadingTask.promise.then((pdf) =>{ - console.log(pdf) this.totalPages=pdf.numPages; - - if(pdf.numPages>this.initNum){ this.showPages = this.initNum; - } else{ this.showPages =pdf.numPages; - } - }).catch((err) =>{ this.$message.error("加载内容失败,请联系管理员"); }); @@ -151,38 +143,29 @@ export default { let outerHeight = document.documentElement.clientHeight let scrollTop = document.documentElement.scrollTop if((outerHeight + scrollTop + 350) >= innerHeight) { - if(this.isscroll){ - this.debounce(this.clickMore(),5000); - } - console.log(this.showPages,this.totalPages) - if( this.showPages >= this.totalPages){ - this.isscroll = false + if(this.isscroll){ + this.debounce(this.clickMore(),6000); + } + if( this.showPages >= this.totalPages){ + this.isscroll = false + } } - - } - - // console.log(this.pdfpage,'000') - // console.log(this.totalPages,this.pdfpage) if(this.pdfpage >= this.totalPages){ this.isscroll = false this.moreState = 3 - // console.log('hcuewhf') } - }, - - debounce(func, wait) {// 非立即执行 - let timeout; - return function () { - let context = this; - let args = arguments; - if (timeout) clearTimeout(timeout); - timeout = setTimeout(() => { - func.apply(context, args) - }, wait); - } -}, + let timeout; + return function () { + let context = this; + let args = arguments; + if (timeout) clearTimeout(timeout); + timeout = setTimeout(() => { + func.apply(context, args) + }, wait); + } + }, prePage(type) { if (this.currentPage > 1) { this.currentPage--;