2018-06-27 14:38:27 +00:00
|
|
|
<script>
|
|
|
|
import feather from 'feather-icons';
|
|
|
|
|
|
|
|
const validIcons = Object.keys(feather.icons);
|
|
|
|
|
|
|
|
export default {
|
2019-11-15 07:46:10 +00:00
|
|
|
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
|
|
|
|
);
|
2018-06-27 14:38:27 +00:00
|
|
|
}
|
2019-11-15 07:46:10 +00:00
|
|
|
return valid;
|
|
|
|
}
|
2018-06-27 14:38:27 +00:00
|
|
|
}
|
2019-11-15 07:46:10 +00:00
|
|
|
},
|
|
|
|
render(h) {
|
|
|
|
let icon = feather.icons[this.name];
|
|
|
|
return h('svg', {
|
|
|
|
attrs: Object.assign({}, icon.attrs, {
|
|
|
|
fill: 'none',
|
|
|
|
stroke: 'currentColor',
|
|
|
|
'stroke-linecap': 'round',
|
|
|
|
'stroke-linejoin': 'round',
|
|
|
|
'stroke-width': 1.5,
|
|
|
|
width: null,
|
|
|
|
height: null
|
|
|
|
}),
|
|
|
|
class: [icon.attrs.class],
|
|
|
|
domProps: {
|
|
|
|
innerHTML: icon.contents
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
2018-06-27 14:38:27 +00:00
|
|
|
</script>
|