Value transfer between vue pure front-end components (between the pop-up window and the page)

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
codeinsert image description here
.
The function of connecting sub-components, when processing saveMes, just receive the data of the sub-components as an actual parameterinsert image description here

** father to son **

子组件使用props接收 接收时还可以设置默认值 当没获取到值时 会使用设置的默认值
同样 看代码会比较易懂一些
父组件

insert image description here
Subcomponent
insert image description here
If you find it useful, you can give it a thumbs up to encourage it.

Guess you like

Origin blog.csdn.net/susu_1111/article/details/122035674