Files
jjx-wap/components/file-type/file-type.vue
T
2026-10-08 18:34:09 +08:00

41 lines
1.3 KiB
Vue

<template>
<view>
<template v-if="['doc', 'docx'].includes(item.split('.').pop())">
<file-word @click="openDownload" theme="outline" class="pointer" size="40" fill="#4a90e2" strokeLinecap="square"/>
</template>
<template v-else-if="['xls', 'xlsx'].includes(item.split('.').pop())">
<file-excel @click="openDownload" theme="outline" class="pointer" size="40" fill="#417505" strokeLinecap="square"/>
</template>
<template v-else-if="['pdf'].includes(item.split('.').pop())">
<file-pdf-one @click="openDownload" theme="outline" class="pointer" size="40" fill="#f5a623"
strokeLinecap="square"/>
</template>
<template v-else>
<el-image :src="item" style="width: 100px; height: 100px" fit="cover"
:preview-src-list="[item]"/>
</template>
</view>
</template>
<script>
import {FileExcel, FilePdfOne, FileWord} from "@icon-park/vue";
export default {
name: "file-type",
components: {FilePdfOne, FileExcel, FileWord},
props: {
item: {
type: String,
default: ''
}
},
data() {
return {}
},
methods: {
openDownload() {
window.location.href = this.item
},
},
}
</script>