You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

43 lines
1.1 KiB

<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";
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>