Child to Parent communication in Vue

First we will create the component name child which will have ta button with click event

Name of the above compoment is child
You have button inside the child element and it has @click="$emit('parentfunc')" which is used to call the funcation name parentfunc in the parent element of this child component

We will just have alert method to show some text as shown in below

Now when you click on the buttom it will call the function parentfunc in the parent element

This is the complete code