Answer the question
In order to leave comments, you need to log in
How would you simplify the component?
<template>
<div :class="className">
<svg class="icon-svg">
<use :xlink:href="`#icon-${icon}`"></use>
</svg>
</div>
</template>
<script>
export default {
name: 'VIcon',
props: {
icon: {
type: String,
required: false,
},
size: {
type: String,
required: false,
},
},
computed: {
className() {
const classList = ['icon'];
if (this.size) {
classList.push(`icon--${this.size}`);
}
return classList;
},
},
};
</script>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question