0👍
Basically it’s structured like this – just put an emit
with the function-name
and the paramters inside of one of your methods
like this:
Child.vue
this.$emit("Your_Function_Name", Parameter_1, Parameter_2);
Than go to your parent.vue
call your emitted function and use it inside your methods
of the parent.vue
:
Parent.vue
<template>
...
<Child @Your_Function_Name="Your_Function_Name">
...
</template>
<script>
methods: {
Your_Function_Name(Parameter_1, Parameter_2) {
console.log(Parameter_1, Parameter_2)
}
}
</script>
Hopefully this helps you out!
Source:stackexchange.com