I recently made a vue project template, and the parent-child components in it pass values. I have some insights and summarize it myself.
child's father
Use this. emitthis . emit this.e m i t t h i s . emit('function',param) param is a parameter.
This way, you can only look at one point. If it is a bit difficult to understand, you can look atthe
code
.
The function of connecting sub-components, when processing saveMes, just receive the data of the sub-components as an actual parameter
** father to son **
子组件使用props接收 接收时还可以设置默认值 当没获取到值时 会使用设置的默认值
同样 看代码会比较易懂一些
父组件
Subcomponent
If you find it useful, you can give it a thumbs up to encourage it.