WholeProcessPlatform/frontend-sjgl/src/components/pdf/pdfView.vue
2026-07-20 16:02:51 +08:00

52 lines
889 B
Vue

<template>
<div class="pdf-view-container">
<iframe
ref="iframeRef"
:src="iframeUrl"
class="pdf-iframe"
frameborder="0"
:title="fileId"
></iframe>
</div>
</template>
<script setup lang="ts">
import { computed } from 'vue';
const props = defineProps({
fileId: {
type: String,
default: ''
}
});
const iframeUrl = computed(() => {
if (!props.fileId) return '';
return (
import.meta.env.VITE_APP_ATTACHMENT_URL +
`/ShowDocument?fileKey=${props.fileId}&backgroundColor=transparent`
);
});
</script>
<style scoped lang="scss">
.pdf-view-container {
width: 100%;
height: 100%;
position: relative;
background-color: #f5f5f5;
}
.pdf-iframe {
width: 100%;
height: 100%;
}
.empty-state {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: #ccc;
font-size: 14px;
}
</style>