core: Methods exposed with defineExpose are not available on custom element
Version
3.2.31
Reproduction link
Steps to reproduce
Open repro and you should see ‘hello’ in the console instead of Uncaught TypeError: ce.value.hello is not a function
What is expected?
Methods exposed with defineExpose are available on given component instance
What is actually happening?
They are not exposed
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 4
- Comments: 15 (4 by maintainers)
Commits related to this issue
- feat(customElement): support for expose on customElement, fix #5540 — committed to hcg1023/core by hcg1023 4 years ago
- feat(custom-element): support for expose on customElement (#6256) close #5540 — committed to vuejs/core by hcg1023 2 years ago
facing the same issue, temporary workaround to access the exposed method via
$.exposed, e.g.I created a PR @LinusBorg #6256
I too have this problem but I got to say that it’s not consistent. Some components work and other don’t. I can’t put a finger on a reason why. They all use
defineExposenormally.It seems to affect components that are conditionally rendered via a
v-ifbut the stackblitz example does not do this, so I have no clue why this is happening.Any progress on that over-a-year-old shortcoming of Vue’s implementation of webcomponents? Is that ever going to land in Vue or should we just create and use a fork to get it implemented?
closed via #6256