This commit is contained in:
linfso 2024-08-18 18:54:09 +08:00
parent 06b6bc2037
commit 23c7d7d1b5

View File

@ -117,16 +117,16 @@ export default {
currentPdfUrl() { currentPdfUrl() {
if (!this.loadPdfUrl) return '' if (!this.loadPdfUrl) return ''
// console.log("====>currentPdfUrl==>",this.loadPdfUrl) console.log("====>currentPdfUrl==>",this.loadPdfUrl)
const publicPath ='/static/' const publicPath ='/static/'
return pdf.createLoadingTask({
url: this.loadPdfUrl,
cMapUrl: `${publicPath}cmaps/`,
cMapPacked: true
})
// return pdf.createLoadingTask({ // return pdf.createLoadingTask({
// url: this.loadPdfUrl // url: this.loadPdfUrl,
// cMapUrl: `${publicPath}cmaps/`,
// cMapPacked: true
// }) // })
return pdf.createLoadingTask({
url: this.loadPdfUrl
})
} }
}, },
watch: { watch: {
@ -143,7 +143,7 @@ export default {
}, },
thisPageCount(value) { thisPageCount(value) {
// console.log("===>thisPageCount==>",value); console.log("===>thisPageCount==>",value);
if(this.isA4){ if(this.isA4){
this.doScale(75); this.doScale(75);
@ -163,7 +163,9 @@ export default {
this.$emit("close"); this.$emit("close");
}, },
async copyImage() { async copyImage() {
if (navigator.clipboard && window.isSecureContext) {
const canvas=this.$refs.pdf.$refs.canvas; const canvas=this.$refs.pdf.$refs.canvas;
// console.log('===>XdPdfWrapper===>', canvas);
let dataURL = canvas.toDataURL({ pixelRatio: 1 }); let dataURL = canvas.toDataURL({ pixelRatio: 1 });
const data = await fetch(dataURL); const data = await fetch(dataURL);
const blob = await data.blob(); const blob = await data.blob();
@ -173,7 +175,11 @@ export default {
[blob.type]: blob, [blob.type]: blob,
}), }),
]); ]);
this.$modal.msgSuccess('复制成功') this.$modal.msgSuccess('复制成功');
}else{
this.$modal.msgError('您的浏览器不支持复制,请截图!');
}
}, },
initA4List(){ initA4List(){
this.cacheA4FileList=[]; this.cacheA4FileList=[];