feat(SvgIcon): svg组件setup语法糖优化

This commit is contained in:
郝先瑞
2022-01-02 10:16:01 +08:00
parent 4dad286f18
commit 8195227725

View File

@@ -4,12 +4,10 @@
</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',
props: {
prefix: { prefix: {
type: String, type: String,
default: 'icon', default: 'icon',
@@ -21,13 +19,10 @@ export default defineComponent({
color: { color: {
type: String, type: String,
default: '' default: ''
}, }
}, })
setup(props) {
const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`); const symbolId = computed(() => `#${props.prefix}-${props.iconClass}`);
return { symbolId };
},
});
</script> </script>
<style scoped> <style scoped>