2018-06-27 14:38:27 +00:00
|
|
|
<template>
|
|
|
|
<div class="feather-icon" v-html="iconSVG"></div>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
|
|
import feather from 'feather-icons';
|
|
|
|
|
|
|
|
const validIcons = Object.keys(feather.icons);
|
|
|
|
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
name: {
|
|
|
|
type: String,
|
|
|
|
required: true,
|
|
|
|
validator(value) {
|
|
|
|
const valid = validIcons.includes(value);
|
|
|
|
if (!valid) {
|
|
|
|
console.warn(`name property for feather-icon must be one of `, validIcons);
|
|
|
|
}
|
|
|
|
return valid;
|
|
|
|
}
|
|
|
|
},
|
|
|
|
size: {
|
|
|
|
type: Number,
|
|
|
|
default: 16
|
|
|
|
}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
iconSVG() {
|
2018-09-26 14:20:35 +00:00
|
|
|
const icon = feather.icons[this.name];
|
|
|
|
if (!icon) {
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
return icon.toSvg({
|
|
|
|
width: this.size,
|
|
|
|
height: this.size
|
|
|
|
});
|
2018-06-27 14:38:27 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
<style>
|
|
|
|
.feather-icon {
|
|
|
|
display: inline-block;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
|