49 lines
1.2 KiB
Vue
49 lines
1.2 KiB
Vue
<template>
|
|
<view class="file-type-box">
|
|
{{ fileAbbreviation }}
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import { computed } from 'vue';
|
|
|
|
const props = defineProps({
|
|
type: String,
|
|
});
|
|
|
|
const fileAbbreviation = computed(() => {
|
|
const typeMap = {
|
|
'application/pdf': 'PDF',
|
|
'application/msword': 'DOC',
|
|
'application/vnd.openxmlformats-officedocument.wordprocessingml.document': 'DOCX',
|
|
'application/vnd.ms-powerpoint': 'PPT',
|
|
'application/vnd.openxmlformats-officedocument.presentationml.presentation': 'PPTX',
|
|
'application/vnd.ms-excel': 'XLS',
|
|
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet': 'XLSX',
|
|
'text/markdown': 'MD',
|
|
'text/plain': 'TXT',
|
|
'text/html': 'HTML',
|
|
'pdf':'PDF',
|
|
'doc':'DOC',
|
|
'docx':'DOCX',
|
|
'ppt':'PPT',
|
|
'pptx':'PPTX',
|
|
'xls': 'XLS',
|
|
'xlsx': 'XLSX',
|
|
'md':'MD',
|
|
'txt':'TXT',
|
|
'html':'HTML'
|
|
};
|
|
return typeMap[props.type] || 'OTHER';
|
|
});
|
|
</script>
|
|
|
|
<style scoped>
|
|
.file-type-box {
|
|
font-weight: 400;
|
|
font-size: 24rpx;
|
|
color: #7b7b7b;
|
|
line-height: 28rpx;
|
|
}
|
|
</style>
|