feat(SvgIcon): svg组件setup语法糖优化
This commit is contained in:
@@ -4,30 +4,25 @@
|
|||||||
</svg>
|
</svg>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script setup lang="ts">
|
||||||
import { defineComponent, computed } from 'vue';
|
import { computed } from 'vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props=defineProps({
|
||||||
name: 'SvgIcon',
|
prefix: {
|
||||||
props: {
|
type: String,
|
||||||
prefix: {
|
default: 'icon',
|
||||||
type: String,
|
|
||||||
default: 'icon',
|
|
||||||
},
|
|
||||||
iconClass: {
|
|
||||||
type: String,
|
|
||||||
required: true,
|
|
||||||
},
|
|
||||||
color: {
|
|
||||||
type: String,
|
|
||||||
default: ''
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
setup(props) {
|
iconClass: {
|
||||||
const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`);
|
type: String,
|
||||||
return { symbolId };
|
required: true,
|
||||||
},
|
},
|
||||||
});
|
color: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user