| 123456789101112131415161718192021222324252627 |
- <template>
- <img :src="icon_src" :alt="file_type" class="file-icon" />
- </template>
- <script setup>
- import { computed } from 'vue';
- const props = defineProps({
- name: String
- });
- const getExtension = (name) => {
- return name?.slice(name.lastIndexOf('.') + 1).toLowerCase() ?? '';
- };
- const icon_src = computed(() => {
- return new URL(`../../assets/ai-search/${getExtension(props.name)}.svg`, import.meta.url).href;
- });
- </script>
- <style scoped>
- .file-icon {
- width: 24px;
- height: 24px;
- background-color: var(--color-bg-1);
- }
- </style>
|