index.vue 487 B

1234567891011121314151617181920212223242526272829
  1. <script lang="ts" setup>
  2. import { computed } from "vue"
  3. interface Props {
  4. prefix?: string
  5. name: string
  6. }
  7. const props = withDefaults(defineProps<Props>(), {
  8. prefix: "icon"
  9. })
  10. const symbolId = computed(() => `#${props.prefix}-${props.name}`)
  11. </script>
  12. <template>
  13. <svg class="svg-icon" aria-hidden="true">
  14. <use :href="symbolId" />
  15. </svg>
  16. </template>
  17. <style lang="scss" scoped>
  18. .svg-icon {
  19. width: 1em;
  20. height: 1em;
  21. fill: currentColor;
  22. overflow: hidden;
  23. }
  24. </style>