0๐
It works when this is done:
<toggle @tog="toggleCheckboxes"></toggle>
and in the Vue.js Part
<button type="button" @click="$emit('tog')">Select All (component)</button>
0๐
You need to understand that you are inside a component, in your case the toggle component.
So, your html is inside, and inside toggle you have nothing, no function define.
Like you said, you need to say to the parent "hey, my button is clicked", the way to do this is to use the $emit
.
On the button click you can add
<button type="button" @click="$emit('selectAll')">Select All (component)</button>
Now, the child say to the parent "selectAll", you need to execute the function you want in the parent component:
<toggle @selectAll="toggleCheckboxes"></toggle>
- [Vuejs]-Auth0 getAccessTokenSilently returns empty object when trying to set vue apollo client bearer token
- [Vuejs]-Vue: How to merge object props with default values
Source:stackexchange.com