You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Vue 3 does not handle events with specific names (capture, once, passive) from custom element #8334
It seems to be an issue with binding @once event. Your reproduction doesn't show any errors, If you look at SFC Playground there's an error thrown by vue:
Cannot read properties of undefined (reading 'toLowerCase')
and it happens because @once event. Others work properly.
Define it as custom element import { defineCustomElement } from "vue"; import Comp from './Comp.ce.vue'; window.customElements.define("my-comp", defineCustomElement(Comp));
Use it in App.vue like custom element <my-comp @capture="capture"></my-comp>
I am sorry, I didn't notice at first that you were using web component., In that case, events such as capture, once, passive indeed don't work with custom elements
@yyx990803 normal component also has the same issues.
I find once problematic in regular components, are there other use cases? I created a new issue(#8341) and submitted a PR(#8342),the test example in this issue(#8334 ) works fine in the PR
Activity
sqal commentedon May 16, 2023
It seems to be an issue with binding @once event. Your reproduction doesn't show any errors, If you look at SFC Playground there's an error thrown by vue:
Cannot read properties of undefined (reading 'toLowerCase')and it happens because
@onceevent. Others work properly.kirillshatalkin commentedon May 16, 2023
@sqal to reproduce you need to define component as Custom Element:
Comp.vuetoComp.ce.vueimport { defineCustomElement } from "vue"; import Comp from './Comp.ce.vue'; window.customElements.define("my-comp", defineCustomElement(Comp));App.vuelike custom element<my-comp @capture="capture"></my-comp>Vue SFC Playground
sqal commentedon May 16, 2023
I am sorry, I didn't notice at first that you were using web component., In that case, events such as capture, once, passive indeed don't work with custom elements
edison1105 commentedon May 16, 2023
There's a problem here. PR welcome.
core/packages/runtime-dom/src/modules/events.ts
Line 60 in d40d4a3
edison1105 commentedon May 17, 2023
@yyx990803 normal component also has the same issues.
baiwusanyu-c commentedon May 23, 2023
I find
onceproblematic in regular components, are there other use cases? I created a new issue(#8341) and submitted a PR(#8342),the test example in this issue(#8334 ) works fine in the PRchore(deps): update vue monorepo to v3.5.39 (#180)