You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
791 B
Vue
34 lines
791 B
Vue
<!-- PDF 文件预览 —— 基于 @file-viewer/vue3 渲染 -->
|
|
<template>
|
|
<div :class="styles.pdfPreviewContainer">
|
|
<FileViewer
|
|
v-if="file"
|
|
:file="file"
|
|
:filename="filename"
|
|
:options="options"
|
|
style="height: 100%"
|
|
/>
|
|
<ElSkeleton v-else :rows="8" animated style="padding: 24px" />
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import allPreset from "@file-viewer/preset-all";
|
|
import { FileViewer } from "@file-viewer/vue3";
|
|
import styles from "../../style/doc.module.scss";
|
|
|
|
interface Props {
|
|
file: ArrayBuffer | null | undefined;
|
|
filename?: string;
|
|
}
|
|
|
|
defineProps<Props>();
|
|
|
|
const options = {
|
|
preset: allPreset,
|
|
rendererMode: "replace" as const,
|
|
theme: "light" as const,
|
|
toolbar: { position: "bottom-right" as const },
|
|
};
|
|
</script>
|