Skip to content

Commit

Permalink
perf: switch to functional component (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
themustafaomar committed Oct 31, 2020
1 parent 61444dd commit 38c34f1
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/feather.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import feather from 'feather-icons';
export default {
name: 'Feather',
functional: true,
props: {
animation: {
type: String,
Expand Down Expand Up @@ -63,17 +63,18 @@ export default {
},
},
render(createElement) {
render(createElement, { listeners, props }) {
const {
animation,
animationSpeed,
size,
type,
} = this;
} = props;
const icon = feather.icons[type];
return createElement(
this.tag,
props.tag,
{
attrs: {
Expand All @@ -89,7 +90,7 @@ export default {
[`feather--${animationSpeed}`]: animationSpeed,
},
on: this.$listeners,
on: listeners,
},
[
Expand All @@ -99,12 +100,12 @@ export default {
{
attrs: {
...icon.attrs,
fill: this.fill,
fill: props.fill,
height: size,
stroke: this.stroke,
'stroke-linecap': this.strokeLinecap,
'stroke-linejoin': this.strokeLinejoin,
'stroke-width': this.strokeWidth,
stroke: props.stroke,
'stroke-linecap': props.strokeLinecap,
'stroke-linejoin': props.strokeLinejoin,
'stroke-width': props.strokeWidth,
width: size,
},
Expand Down

0 comments on commit 38c34f1

Please sign in to comment.