<template>
  <svg class="svg-icon" aria-hidden="true">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script lang="ts" setup>
import { computed } from 'vue'

const props = defineProps({
  // 本地 icon 图标
  icon: {
    type: String,
    required: true
  }
})

/**
 * 项目内本地图标
 */
const iconName = computed(() => `#${props.icon}`) // 添加配置对应链接名
</script>

<style scoped lang="scss">
.svg-icon {
  overflow: hidden;
  width: 1em;
  height: 1em;
  outline: none;
  vertical-align: -0.15em;
  fill: currentcolor;
}
</style>
