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

Inline statement event handler should be 'return' #8999

Closed
tianjianchn opened this issue Oct 28, 2018 · 4 comments
Closed

Inline statement event handler should be 'return' #8999

tianjianchn opened this issue Oct 28, 2018 · 4 comments

Comments

@tianjianchn
Copy link

What problem does this feature solve?

See @click="doSomething('params')", the generated code will be function($event){doSomething('params')}, no return in it. Normal syntax with method name only has the return. So I think consistent may be better.
And the use case is child component may want to manually call the event handler to get the result, not through this.$emit

What does the proposed API look like?

No added api

@sirlancelot
Copy link

You cannot get the return values of events through $emit(). It would not work that way because multiple handlers can attach to a single event.

@tianjianchn
Copy link
Author

@sirlancelot You are right. So I use this.$listeners.click($event)

@tianjianchn
Copy link
Author

@sirlancelot Maybe $emit() can return the result array if there are multiple handlers? Anyway, that's another topic😀

@posva
Copy link
Member

posva commented Oct 28, 2018

Duplicate of #7628

@posva posva marked this as a duplicate of #7628 Oct 28, 2018
@posva posva closed this as completed Oct 28, 2018
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

No branches or pull requests

3 participants