Skip to content

Commit

Permalink
fix(features): 解决文件预览功能路径引入不正确的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
baiwumm committed Oct 10, 2024
1 parent 753861e commit 2948e0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 18 deletions.
9 changes: 3 additions & 6 deletions web/src/views/features/vue-office/modules/vue-office-docx.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import VueOfficeDocx from '@vue-office/docx';
import type { UploadProps } from 'ant-design-vue';
import { ref } from 'vue';
import DocxFile from '@/assets/office/test.docx?url';
defineOptions({
name: 'VueOfficeDocx',
});
// 获取文件地址
const getFileUrl = (file: string) => {
return new URL(file, import.meta.url).href;
};
const loading = ref(true);
const src = ref(getFileUrl('../../../../assets/office/test.docx'));
const src = ref(DocxFile);
// 渲染完成
const renderedHandler = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,14 @@ import VueOfficeExcel from '@vue-office/excel';
import type { UploadProps } from 'ant-design-vue';
import { reactive, ref } from 'vue';
import XlsxFile from '@/assets/office/test.xlsx?url';
defineOptions({
name: 'VueOfficeExcel',
});
// 获取文件地址
const getFileUrl = (file: string) => {
return new URL(file, import.meta.url).href;
};
const loading = ref(true);
const src = ref(getFileUrl('../../../../assets/office/test.xlsx'));
const src = ref(XlsxFile);
const options = reactive({
xls: false, // 预览xlsx文件设为false;预览xls文件设为true
minColLength: 0, // excel最少渲染多少列,如果想实现xlsx文件内容有几列,就渲染几列,可以将此值设置为0.
Expand Down
9 changes: 3 additions & 6 deletions web/src/views/features/vue-office/modules/vue-office-pdf.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,14 @@ import VueOfficePdf from '@vue-office/pdf';
import type { UploadProps } from 'ant-design-vue';
import { ref } from 'vue';
import PdfFile from '@/assets/office/test.pdf?url';
defineOptions({
name: 'VueOfficePdf',
});
// 获取文件地址
const getFileUrl = (file: string) => {
return new URL(file, import.meta.url).href;
};
const loading = ref(true);
const src = ref(getFileUrl('../../../../assets/office/test.pdf'));
const src = ref(PdfFile);
// 渲染完成
const renderedHandler = () => {
Expand Down

0 comments on commit 2948e0e

Please sign in to comment.