Files
admin-sjzx/src/components/PreviewFile/index.vue

31 lines
1.1 KiB
Vue
Raw Normal View History

2024-06-06 22:14:20 +08:00
<template>
<div style="overflow: auto; height: 100vh">
<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-pdf v-if="url.includes('.pdf')" :src="url" />
2024-06-12 16:16:02 +08:00
<img
v-if="url.includes('.png') || url.includes('.jpg') || url.includes('.gif') || url.includes('.bmp')"
:src="url"
/>
2024-06-06 22:14:20 +08:00
</div>
</template>
<script lang="ts" setup>
import { useRouter } from 'vue-router'
2024-06-07 14:29:28 +08:00
import { ref } from 'vue'
2024-06-06 22:14:20 +08:00
//引入相关样式
import '@vue-office/excel/lib/index.css'
//引入VueOfficeDocx组件
import VueOfficeDocx from '@vue-office/docx'
import VueOfficeExcel from '@vue-office/excel'
//引入VueOfficePdf组件
import VueOfficePdf from '@vue-office/pdf'
2024-06-07 14:29:28 +08:00
const { push, options, currentRoute } = useRouter()
2024-08-07 11:20:00 +08:00
// const url = 'http://192.168.1.22:9009/excelreport' + currentRoute.value.href?.split('?')[1]
2024-08-28 16:34:31 +08:00
const url = '/api-docx/excelreport' + currentRoute.value?.href?.split('?')[1]
2024-06-06 22:14:20 +08:00
onMounted(() => {
console.log()
})
</script>
<style lang="less" scoped></style>