4 changed files with 52 additions and 2 deletions
@ -0,0 +1,43 @@ |
|||
<template> |
|||
<div id="div-container" style="height:100%;overflow: auto; "> |
|||
<img v-for="(item, index) in imgList" :key="index" class="img-box" :src="item" style="width: 100%" /> |
|||
</div> |
|||
|
|||
</template> |
|||
|
|||
<script > |
|||
import {baseUrl} from "@/config/env"; |
|||
import {transPdf} from "@/api/enforce.js"; |
|||
|
|||
export default { |
|||
name: 'PdfViewer', |
|||
data() { |
|||
return { |
|||
imgList:[], |
|||
// 可引入网络文件或者本地文件 |
|||
pdfUrl: "http://192.168.110.36:85/profile/upload/2024/03/29/40eb1a97ca27c3369370e90632d92db0.pdf", |
|||
}; |
|||
}, |
|||
mounted() { |
|||
this.pdfUrl =baseUrl+ this.$route.query.url; |
|||
console.log("pdf地址", this.pdfUrl) |
|||
this.loadImage(); |
|||
}, |
|||
methods: { |
|||
loadImage() { |
|||
let searchParam = reactive({url: this.$route.query.url}); |
|||
transPdf(searchParam, success => { |
|||
this.imgList = success.data; |
|||
if (success.data.length > 0) { |
|||
this.imgList.forEach((item, index) => { |
|||
this.imgList[index] = "data:image/png;base64,"+item; |
|||
}); |
|||
} |
|||
}, error => { |
|||
|
|||
}) |
|||
} |
|||
|
|||
}, |
|||
}; |
|||
</script> |
|||
Loading…
Reference in new issue