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

[2.0][suggestion] pass v-on event handlers on functional component #3168

Merged
merged 1 commit into from Jul 2, 2016

Conversation

kazupon
Copy link
Member

@kazupon kazupon commented Jun 28, 2016

Sometimes, there are times when we pass v-on event handlers to render function arguments on functional component.

The below URL is implemented example with v-bind on functional component.
http://jsfiddle.net/kazupon/bjp40byw/6/

In example, we need to define handler in props.
I think that come in useful by v-on event handers passing through.

@dsonet
Copy link
Contributor

dsonet commented Jun 28, 2016

var on = { valid: props.onValid, invalid: props.onInvalid }
 var vnode = h('validate-input-control', { props: props, on: on })

why gather the properties from props since there is props passed already? Seems duplicated.

@phanan phanan added the 2.0 label Jun 29, 2016
@kazupon
Copy link
Member Author

kazupon commented Jun 29, 2016

In virtual-dom system of vue 2.0, when we are necessary in order to communicate the parent-child components, need to use the on.

@yyx990803
Copy link
Member

I think it's more straightforward to have only props as the second argument. We can pass the raw data as the 4th argument, since it's going to be rarely used, only for advanced users.

@kazupon
Copy link
Member Author

kazupon commented Jul 1, 2016

That's sounds good.
I'll try to fix now.

@kazupon kazupon force-pushed the improve/functional-component branch from 946e92a to d54b26f Compare July 1, 2016 07:18
@yyx990803 yyx990803 merged commit c665a68 into vuejs:next Jul 2, 2016
@kazupon kazupon deleted the improve/functional-component branch July 2, 2016 23:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants