index.vue :
<template><div><child-component :parent-msg="message" @child-event="handleChildEvent"></child-component></div>
</template><script>
import childComponent from './childComponent.vue';export default {components: {childComponent},data() {return {message: 'Hello from parent kingbal.com'};},methods: {handleChildEvent(payload) {console.log('Received from child:', payload);}}
};
</script>
childComponent.vue :
<template><div><p>{{ parentMsg }}</p><button @click="sendToParent">Send to Parent kingbal.com</button></div>
</template><script>
export default {props: ['parentMsg'],methods: {sendToParent() {this.$emit('child-event', 'Hello from child');}}
};
</script>