In fact, the document is very clear about the data transfer between parent and child components.
But if people who don't understand at all can't understand, Here is a small example, There are two files
1.parent.vue
<template> <child :child-msg="msg" @ok="event"></child> </template> <script>
import child from'./child.vue'; export default { data(){ return{ msg:'hello
worldgogo' } }, components:{ child }, methods:{ event(val){ console.log(val); }
} }</script> <!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped> </style>
2.child.vue
<template> <p>{{childMsghello}}</p> </template> <script> export default {
props: ['childMsg'], data(){ return{ childMsghello:this.childMsg+'this is child'
} }, created(){// Custom events, And set the value of the callback function listening for this event to200 this.$emit('ok','200'); } } </
script> <!-- Add "scoped" attribute to limit CSS to this component only --> <
style scoped> </style>
You can match the route by yourself. It's not going to get cold...... And then you can look at the documentation