-
Notifications
You must be signed in to change notification settings - Fork 787
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
Custom Events with uppercase characters no longer work in Vue #2804
Comments
This happens because of a change in the way Vue 3 uses in-DOM templates. While this did work in Vue 2, even then they recommended using kebab-cased event names. From this page:
Unfortunately this isn't something Stencil can fix, and it was such a pain that it caused me to rework custom event names in Shoelace. 😓 FWIW, this isn't specific to Vue. Any library that uses declarative binding with in-DOM templates will run into the same problem. Since converting all events to lowercase may not be feasible, there's an undocumented feature that Ionic uses to translate custom event names on the fly in the await defineCustomElements(window, {
ce: (eventName: string, opts: any) => new CustomEvent(eventName.toLowerCase(), opts)
} as any); I hope that helps! |
same issue: stencil components events not working in Vue 3 |
a small "fix" when waiting a fix from Vue 3
this will lowercase all your events, Since this problem is for all web components and not only Stencil, I don't think the Stencil team can do something about it. this issue is referenced in the Vue repo (vuejs/core#2460). |
I am using Update: seems like the |
Just ran into this issue. Going to be updating all of our custom events from camelCase to kebab-case so they work with Vue 3. I think it would be good to update Stencil's event docs to use kebab-case as well: |
Have you tested the v-model feature with this "hack" ? on my side, nothing happens with the v model directive |
Hey all 👋 Based on the conversation, it sounds like this evolved into more of a support request/topic as it falls outside Stencil's scope. As such, I'm going to get this labeled and closed out appropriately. Hopefully everyone was able to work around the issue within Vue! |
Thanks for the issue! This issue appears to be a support request. We use this issue tracker exclusively for bug reports and feature requests. Please use our slack channel for questions about Stencil. Thank you for using Stencil! |
I created an input in stenciljs and I have register a valueChanged event in there. Then I want to use the input in vue with the v-model directive. But the the event @valueChanged does not work in vue 3, but it does in vue 2.
Vue 3:
vue 2:
My code in vue2 and vue3 are the same:
The text was updated successfully, but these errors were encountered: