feat(文件预览): 添加对PDF、Word和Excel文件的预览支持
添加新的文件预览组件,支持PDF、Word(docx)、Excel(xlsx/xls)文件类型预览 重构图片预览为独立组件,并添加相关依赖包
This commit is contained in:
34
klp-ui/src/components/FilePreview/preview/pdf/index.vue
Normal file
34
klp-ui/src/components/FilePreview/preview/pdf/index.vue
Normal file
@@ -0,0 +1,34 @@
|
||||
<template>
|
||||
<div class="preview-pdf">
|
||||
<iframe
|
||||
:src="src"
|
||||
class="preview-pdf-content"
|
||||
frameborder="0"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "PdfPreview",
|
||||
props: {
|
||||
src: {
|
||||
type: String,
|
||||
required: true,
|
||||
description: "PDF文件的URL或路径"
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.preview-pdf {
|
||||
width: 100%;
|
||||
height: 70vh;
|
||||
}
|
||||
|
||||
.preview-pdf-content {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user