How to use $attrs to inherit events in Web Components built with vue3 #7697
Unanswered
101polarbears
asked this question in
Help/Questions
Replies: 1 comment 2 replies
-
<template>
<custom-entry ref="entryRef"><custom-entry>
</template>
<script setup>
import { ref, onMounted } from 'vue'
const entryRef = ref(null)
const handler = () => {
// clicking the button does NOT trigger this handler
console.log('custom test event captured');
};
onMounted(() => {
entryRef.value?.addEventListener('test', handler)
})
</script> Webcomponent is an event defined by CustomEvent, so you need to add event listeners to the instance. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I was trying to inherit attributes (props and events) passed into web components built with vue3
In the process, I found
I am not sure if I had put stuff incorrectly or the feature is simply not supported
Or any suggested work around?
here's the setup (inside a vite project)
Beta Was this translation helpful? Give feedback.
All reactions