pdf预览地址加密处理

This commit is contained in:
daihh
2022-06-08 09:28:27 +08:00
parent 4e05752ca4
commit be82ad85b6
2 changed files with 41 additions and 21 deletions

View File

@@ -114,33 +114,33 @@ export default {
this.showPages++;
}
this.isscroll = true;
},
},
//加载页面
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("加载内容失败,请联系管理员");
});
}
},
@@ -149,11 +149,11 @@ export default {
let innerHeight = document.querySelector('#pdf-perView').clientHeight
let outerHeight = document.documentElement.clientHeight
let scrollTop = document.documentElement.scrollTop
if(this.isscroll){
this.showPages++;
this.debounce(this.loadInitPdf(),5000);
}
// console.log(this.pdfpage,'000')
// console.log(this.totalPages,this.pdfpage)
@@ -168,8 +168,8 @@ export default {
// document.querySelector('#articleAnking').style.cssText = "position: static";
// }
},
debounce(func, wait) {// 非立即执行
let timeout;
return function () {
@@ -229,6 +229,7 @@ export default {
min-height: 300px;
width: 100%;
//border: 1px solid #dfdfdf;
background-color: #e9e9e9;
overflow-y: hidden;
overflow-x: hidden;
>span{