-
Notifications
You must be signed in to change notification settings - Fork 119
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
vue-output-target: Can't handle updating v-model value when the event name provided is on camelCase #262
Comments
Had the same problem too, worked around it in the same fashion by declaring a kebab-case |
Same problem and same fix seems to be working. |
This is fixed now with Vue 3.2.38 onwards: vuejs/core#5401 (comment) @rwaskiewicz Please fix the VueJS output target. With 3.2.38, which was released 8 months ago, VueJS works with any custom event names. The problem now is that the events are still converted to lowercase in the output target:
This should be at least configurable to be backwards compatible. Edit: Also, it is currently not possible to register event handlers for custom events that are not configured for the model update logic. For example:
VueJS maps @myevent to an onMyEvent property. Internally VueJS uses toHandlerKey to convert an myEvent to onMyEvent and map to the correct property. These functions are even exported from "vue". Therefor our custom event "myEvent" is not handled, if we do not re-emit them inside the utils and the correct mapping is applied. I got it working by patching the generated utils.ts: const onVnodeBeforeMount = ... {
...
var eventProperties = Object.keys(vnode.props).filter(x => x.startsWith('on'));
eventProperties = eventProperties.map(x => {
x = x.replace('on', '');
x = x.charAt(0).toLowerCase() + x.slice(1);
return x;
});
eventProperties.forEach((eventName: string) => {
console.log(`Register event handler for ${eventName}`)
vnode.el!.addEventListener(eventName, (e: Event) => {
emit(eventName, e);
});
});
}
... |
seems like it's been a while and the issues still persists. https://github.com/ionic-team/ionic-framework/blob/main/packages/vue/src/ionic-vue.ts#L19 I think removing the |
I declared a custom event named
ivInput
on my custom componentAnd set the vue component model config on my
stencil.config.js
But when I tried to use
v-model
on my Vue app, the model value is not updating. I checked theutils.ts
and found out that theeventName
is being converted to lower case (line 79).eventName
string case should not be converted or modified to lower case under the hood and should be matched exactly with what is being provided on the config. IMO[EDITED]
I made it work for now by declaring a non-camel case
eventName
on the component event decorator. But as I said earlier,The text was updated successfully, but these errors were encountered: