51 lines
953 B
Vue

<template>
<svg
:class="svgClass"
aria-hidden="true"
v-bind="$attrs">
<use :xlink:href="svgName" />
</svg>
</template>
<script>
export default {
name: 'VSvg',
props: {
iconName: {
type: String,
default: '',
required: true,
},
className: {
type: String,
default: '',
},
},
computed: {
svgName() {
if (!this.iconName) {
return '#icon-default';
}
return `#icon-${this.iconName}`;
},
svgClass() {
if (this.className) {
return 'svg-icon ' + this.className;
}
return 'svg-icon';
},
},
};
</script>
<style scoped>
.svg-icon {
width: 1em;
height: 1em;
/*vertical-align: -0.15em;*/
fill: currentColor;
overflow: hidden;
font-size: 16px;
}
</style>