修改 xls文件无法预览问题

This commit is contained in:
GGJ
2024-10-15 10:39:28 +08:00
parent 7062305c01
commit 9404412823
7 changed files with 37 additions and 15 deletions

View File

@@ -16,7 +16,8 @@
<!-- <el-empty description="暂无数据" class="custom-empty iframe" /> -->
<div :style="`overflow: auto;`" class="iframe">
<vue-office-docx v-if="url.includes('.doc') || url.includes('.docx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url" />
<vue-office-excel v-if="url.includes('.xls') || url.includes('.xlsx')" :src="url"
:options="excelOptions" />
<!-- <vue-office-pdf v-if="url.includes('.pdf')" :src="url" /> -->
<iframe v-if="url.includes('.pdf')" :src="url" style="width: 100%; height: 99%"></iframe>
<img v-if="
@@ -49,12 +50,14 @@ const drawer = ref(false)
const activeName = ref('2')
const num = ref(0)
const url = ref('')
const excelOptions = ref({})
const information = adminInfo.roleCode.includes('information_info')
const open = (row: any) => {
// console.log('🚀 ~ open ~ row:', row)
// url.value = row
drawer.value = true
url.value = `/api-docx/excelreport` + row
excelOptions.value = { xls: row.split('.')[1] == 'xls' ? true : false }
// getFileNameAndFilePath({ filePath: row }).then(res => {
// url.value = res.data.url
// })