30 lines
590 B
Vue
30 lines
590 B
Vue
|
<template>
|
||
|
<svg aria-hidden="true">
|
||
|
<use :xlink:href="symbolId" :fill="color" />
|
||
|
</svg>
|
||
|
</template>
|
||
|
|
||
|
<script setup name="QSvg" lang="ts">
|
||
|
const props = defineProps({
|
||
|
prefix: {
|
||
|
type: String,
|
||
|
default: 'icon',
|
||
|
},
|
||
|
name: {
|
||
|
type: String,
|
||
|
required: false,//页面刷新的时候,请求数据返回慢,会报一个类型错误
|
||
|
default: 'buy'
|
||
|
},
|
||
|
color: {
|
||
|
type: String,
|
||
|
default: '#333',
|
||
|
},
|
||
|
});
|
||
|
const symbolId = computed(() => `#${props.prefix}-${props.name}`);
|
||
|
defineExpose({
|
||
|
symbolId: symbolId,
|
||
|
});
|
||
|
</script>
|
||
|
|
||
|
<style lang="less" scoped></style>
|