Vue component usage (the parent component listens to the data changes of the child component, the child component uses the data of the parent component, and listens to the data changes of the parent component)

Child component uses parent component data

parent component

The parent component declares variables and
Insert image description here
the parent component passes data to the child component.
Insert image description here

Subassembly

Insert image description here
Insert image description here
Note: Do not modify this data in subcomponents, otherwise an error will be reported

Child components monitor data changes of parent components

Subassembly

Insert image description here

The parent component monitors the data changes of the child component

Subassembly

Subcomponent variable declaration
Insert image description here
Insert image description here

parent component

Insert image description here
Insert image description here
Insert image description here

Guess you like

Origin blog.csdn.net/laodanqiu/article/details/129370442