mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/vue/learning-system-portal.git
synced 2025-12-15 05:46:43 +08:00
提交
This commit is contained in:
@@ -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("加载内容失败,请联系管理员");
|
||||
});
|
||||
@@ -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--;
|
||||
|
||||
Reference in New Issue
Block a user