Commit f8e206b5 by liangzhen

修复页面

1 parent 3c773bac
<!-- 结果公示 --><template> <template>
<div> <div>
<pdf v-for="i in pageCount" <iframe src="http://192.168.91.1:18000/static/#/assessResult/release/notice" frameborder="0" style="width:100vw;height:100vh;" id="iframe" ></iframe>
:src="pdfSrc"
:key="i + 'pdf'"
:page="i"
class="pdf-item"></pdf>
</div> </div>
</template> </template>
<script> <script>
import pdf from 'vue-pdf' export default {
export default {
data(){ data(){
return{ return{
pageCount: 1,
// 缩放
scale: 100,
timer: null,
showPreviewFile: false,
pdfSrc:"http://arch-file.oss-cn-beijing.aliyuncs.com/arch-file/665994f479f6157c744951bd.pdf?Expires=1718011134&OSSAccessKeyId=LTAI5tGjidtvVSCvwGxTp8FH&Signature=blOuzxUwnotgqo7mxM9rShOEJ1I%3D"
} }
}, },
components:{ pdf},
mounted(){ mounted(){
this.previewFile()
},
watch: {
pdfUrl: {
handler(newVal, oldVal) {
if (newVal) {
this.previewFile()
}
},
immediate: false
}
},
methods: {
/** pdf加载 */
async previewFile() {
try {
let loadingTask = pdf.createLoadingTask({
url: this.pdfUrl,
CMapReaderFactory
});
loadingTask.promise.then(pdf => {
this.pdfUrl = loadingTask
this.showPreviewFile = true;
this.pageCount = pdf.numPages;
}).catch((e) => {
console.log("pdf初始化错误", e);
Notify("文件初始化失败,请返回下载该文件查看")
})
} catch (e) {
this.$router.go(-1)
console.log("pdf加载出错了", e);
}
},
}
} }
</script>
<style lang="scss" scoped> }
.process-fileView-pdf-container { </script>
<style lang="scss" scoped>
#iframeId{
width: 100%; width: 100%;
height: 100%;
.pdf-item{
height: 100vh; height: 100vh;
display: block !important; }
}
.pdf-button-group { </style>
position: fixed; \ No newline at end of file
top: 10px;
right: 20px;
.btn-item {
width: 50px;
height: 50px;
border-radius: 100%;
}
.div-item {
margin-bottom: 8px;
}
::v-deep .van-button__text{
line-height: 20px;
}
}
}
</style>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!