magic-icon.vue 511 B

123456789101112131415161718192021222324252627
  1. <template>
  2. <svg aria-hidden="true" :class="prefix">
  3. <use :xlink:href="symbolId" :class="prefix + '-' +icon"/>
  4. </svg>
  5. </template>
  6. <script setup>
  7. import { computed } from 'vue'
  8. const props = defineProps({
  9. prefix: {
  10. type: String,
  11. default: 'magic-icon'
  12. },
  13. icon: String,
  14. size: String,
  15. });
  16. const symbolId = computed(() => `#${props.prefix}-${props.icon}`)
  17. </script>
  18. <style scoped>
  19. svg {
  20. width: 1.3em;
  21. height: 1.3em;
  22. vertical-align: -0.25em;
  23. overflow: hidden;
  24. fill: var(--main-icon-color)
  25. }
  26. </style>