Child the parent:

1. The child provides the data, and the parent takes the initiative to get it when needed

The parent component can invoke and fire child component methods and events by ref, and can retrieve child component data

The parent component



Child components



The results of




The father the son

The child component uses props to receive data from the parent component

The parent component:



Child components:



A value passed from a parent to a child changes in the parent, and the child changes with it

The first is through watch

The second is through computed

The parent component



Child components:

Watch to monitor



The computed to monitor



Computed and watch achieve the same effect in this simple example, whether it is using someone to listen or looking at the scene





The child component changes the value passed in props

You can’t change the values that are passed in props directly in a subcomponent, so we can do that using the event mechanism, or we can do that using.sync

(1) Event mechanism

The parent component



Child components



(2). The sync

The parent component



Child components




Pass values through bus