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
Hi everyone, I'am trying to create components library in Vue 3 using composition api.
Problem:
**I created reusable 'Serach component' that I am using inside of 'Header component' and I need to somehow share search value even outside of Header component without using any state management library.
So I am emitting search value to it's parent component (Header) and then even further and it works when I implement header in App.js. But when I create npm package and install it in another project I can not access Search value.**
My Header component emit:
`const emit = defineEmits(['searchPhrase']);
It seems like emits just doesn't work then. In the console I am getting this: [Vue warn]: Component emitted event "toggleSearch" but it is neither declared in the emits option nor as an "onToggleSearch" prop.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Hi everyone, I'am trying to create components library in Vue 3 using composition api.
Problem:
**I created reusable 'Serach component' that I am using inside of 'Header component' and I need to somehow share search value even outside of Header component without using any state management library.
So I am emitting search value to it's parent component (Header) and then even further and it works when I implement header in App.js. But when I create npm package and install it in another project I can not access Search value.**
My Header component emit:
`const emit = defineEmits(['searchPhrase']);
const handleSearchPhrase = (payload) => {
emit('searchPhrase', payload);
};`
It seems like emits just doesn't work then. In the console I am getting this:
[Vue warn]: Component emitted event "toggleSearch" but it is neither declared in the emits option nor as an "onToggleSearch" prop.
Beta Was this translation helpful? Give feedback.
All reactions