From 23c7d7d1b5823de0dcf82f3273ecf4dabee733f2 Mon Sep 17 00:00:00 2001 From: linfso Date: Sun, 18 Aug 2024 18:54:09 +0800 Subject: [PATCH] md --- src/components/PdfViewer/viewer.vue | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/src/components/PdfViewer/viewer.vue b/src/components/PdfViewer/viewer.vue index 5602d54f..646e320c 100644 --- a/src/components/PdfViewer/viewer.vue +++ b/src/components/PdfViewer/viewer.vue @@ -117,16 +117,16 @@ export default { currentPdfUrl() { if (!this.loadPdfUrl) return '' - // console.log("====>currentPdfUrl==>",this.loadPdfUrl) + console.log("====>currentPdfUrl==>",this.loadPdfUrl) const publicPath ='/static/' - return pdf.createLoadingTask({ - url: this.loadPdfUrl, - cMapUrl: `${publicPath}cmaps/`, - cMapPacked: true - }) // return pdf.createLoadingTask({ - // url: this.loadPdfUrl + // url: this.loadPdfUrl, + // cMapUrl: `${publicPath}cmaps/`, + // cMapPacked: true // }) + return pdf.createLoadingTask({ + url: this.loadPdfUrl + }) } }, watch: { @@ -143,7 +143,7 @@ export default { }, thisPageCount(value) { - // console.log("===>thisPageCount==>",value); + console.log("===>thisPageCount==>",value); if(this.isA4){ this.doScale(75); @@ -163,7 +163,9 @@ export default { this.$emit("close"); }, async copyImage() { + if (navigator.clipboard && window.isSecureContext) { const canvas=this.$refs.pdf.$refs.canvas; + // console.log('===>XdPdfWrapper===>', canvas); let dataURL = canvas.toDataURL({ pixelRatio: 1 }); const data = await fetch(dataURL); const blob = await data.blob(); @@ -173,7 +175,11 @@ export default { [blob.type]: blob, }), ]); - this.$modal.msgSuccess('复制成功') + this.$modal.msgSuccess('复制成功'); + }else{ + this.$modal.msgError('您的浏览器不支持复制,请截图!'); + } + }, initA4List(){ this.cacheA4FileList=[];