This commit is contained in:
zhaofang
2022-06-08 14:42:25 +08:00
parent 8ec2f94c4f
commit 80892507f4

View File

@@ -31,8 +31,9 @@
<span v-if="loadedRatio !== 1" style="margin:0 10px;">0 / 0</span>
<span v-else style="margin:0 10px;">{{ currentPage }} / {{ pageCount }}</span>
<el-button @click="nextPage('footer')" :disabled="loadedRatio !== 1" icon="el-icon-arrow-right"></el-button> -->
<el-button type="text" v-if="moreState == 1"> 加载更多 </el-button>
<el-button type="text" v-if="moreState == 2">加载中</el-button>
<span class="pag-text-msg" v-if="moreState == 1"> 加载更多 </span>
<span class="pag-text-msg" v-if="moreState == 2">加载中</span>
<span class="pag-text-msg" v-if="moreState == 3">没有更多数据了</span>
</div>
</div>
</template>
@@ -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("加载内容失败,请联系管理员");
});
@@ -152,26 +144,17 @@ export default {
let scrollTop = document.documentElement.scrollTop
if((outerHeight + scrollTop + 350) >= innerHeight) {
if(this.isscroll){
this.debounce(this.clickMore(),5000);
this.debounce(this.clickMore(),6000);
}
console.log(this.showPages,this.totalPages)
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 () {
@@ -182,7 +165,7 @@ export default {
func.apply(context, args)
}, wait);
}
},
},
prePage(type) {
if (this.currentPage > 1) {
this.currentPage--;