treeIcon.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <template>
  2. <icon class="iconfont" :iconName="iconNam" />
  3. </template>
  4. <script setup lang="ts">
  5. import icon from './index.vue';
  6. import { computed } from 'vue';
  7. const type = {
  8. file: 'icon-document',
  9. // js: 'icon-javascript',
  10. // json: 'icon-json',
  11. // vue: 'icon-vue',
  12. // scss: 'icon-sass',
  13. // file: 'icon-file',
  14. // md: 'icon-mdx',
  15. // tsx: 'icon-react1',
  16. // ts: 'icon-typescript',
  17. // css: 'icon-css',
  18. // png: 'icon-image',
  19. // jpg: 'icon-image',
  20. // jpeg: 'icon-image',
  21. // webp: 'icon-image',
  22. // gif: 'icon-image',
  23. // html: 'icon-html',
  24. // babelrc: 'icon-babel',
  25. };
  26. const props = defineProps({
  27. title: String,
  28. });
  29. const iconNam = computed(() => {
  30. // const suffix = (props.title || '.file').split('.').pop().toLowerCase();
  31. // console.log(suffix, 'suffix');
  32. // if (props.title == 'package.json') return 'icon-npm';
  33. // return type[suffix];
  34. return type['file'];
  35. });
  36. </script>
  37. <style lang="less" scoped>
  38. .iconfont {
  39. width: 16px;
  40. height: 16px;
  41. }
  42. </style>