ZhangXianQiang
2024-07-04 d77ff074e895d16b99f72386dd50655500cdb435
fix:文件大小写问题
1个文件已添加
41 ■■■■■ 已修改文件
src/components/PDFViewer/index.vue 41 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/components/PDFViewer/index.vue
New file
@@ -0,0 +1,41 @@
<template>
  <div class="pdf-container">
    <iframe :src="fileUrl" width="100%" height="100%"></iframe>
  </div>
</template>
<script setup>
import { ref, onMounted } from 'vue';
const props = defineProps({
  pdfUrl: {
    type: String,
    required: true
  }
});
const viewerUrl = '/pdfjs/web/viewer.html?file='; // pdfjs文件地址
const fileUrl = ref('');
const renderPDF = () => {
  fileUrl.value = viewerUrl + encodeURIComponent(props.pdfUrl);
};
onMounted(() => {
  renderPDF();
})
</script>
<style lang="scss" scoped>
.pdf-container {
  width: 100%;
  height: 100%;
  .pdf-canvas {
    width: 100%;
    height: 100%;
  }
}
</style>