Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: switch to functional component #4

Merged
merged 1 commit into from
Oct 31, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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