-
-
Notifications
You must be signed in to change notification settings - Fork 8.6k
add eventHandler after component mounted #2155
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
Comments
See https://v3.vuejs.org/guide/migration/events-api.html#overview Hi, thanks for your interest but Github issues are for bug reports and feature requests only. You can ask questions on the forum, the Discord server or StackOverflow. |
@posva bro, I know use other event emitter instead of new Vue. It is feature, not question buttonRef.$props.onClick = evt => alert(1) not work because of code It means if we want add eventHandler, the only way is @click in template, we cannot do the same thing when we got buttonRef in setup. any way ? But in 2.0 is OK |
In native Dom, we can onclick="handleClick" or we can dom.addEventListener as we want |
Have you tried something like |
@posva this is for component container listener,not component emitted listener |
The components no longer implement that API: https://v3.vuejs.org/guide/migration/events-api.html#overview it went through an RFC vuejs/rfcs#118 |
@posva no way to listen component emitted inside setup?very sad ... |
it should be buttonRef.onClick = comp emitted click event |
What problem does this feature solve?
I am writing VCA called useEventListener,which can be used to addEventListener with native HTML element and $on with Vue Component(2.0 @vue/composition-api)。while in Vue 3.0, there are no $on any more and cannot add new eventHandler after component mounted(e.g. with component ref)
What does the proposed API look like?
readonly proxy can set onXXX instead of reject with warning message
The text was updated successfully, but these errors were encountered: