2022-06-16 01:17:31 +08:00
|
|
|
<template>
|
2022-06-16 11:07:43 +08:00
|
|
|
<svg aria-hidden="true" width="1em" height="1em">
|
2022-06-16 01:17:31 +08:00
|
|
|
<use :xlink:href="symbolId" fill="currentColor" />
|
|
|
|
</svg>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
|
|
|
import { computed } from 'vue';
|
|
|
|
|
2022-07-10 14:02:00 +08:00
|
|
|
defineOptions({ name: 'SvgIcon' });
|
|
|
|
|
2022-06-16 01:17:31 +08:00
|
|
|
interface Props {
|
|
|
|
/** 前缀 */
|
|
|
|
prefix?: string;
|
|
|
|
/** 图标名称(图片的文件名) */
|
|
|
|
icon: string;
|
|
|
|
}
|
|
|
|
|
|
|
|
const props = withDefaults(defineProps<Props>(), {
|
|
|
|
prefix: 'icon-custom'
|
|
|
|
});
|
|
|
|
|
|
|
|
const symbolId = computed(() => `#${props.prefix}-${props.icon}`);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped></style>
|