vue3 provide and inject multi-level use, as well as data monitoring

Record the values ​​passed using provide and inject, the values ​​passed by the grandson component, and how to monitor data changes in the top-level component.

1.Used by ordinary value transfer

Introduce provide in the value passing page

pass data

Introduced on the receiving page

Receive data

Use operational data

2. Pass it to the grandchild component and monitor data changes

The usage method is similar to the above, but if you need to monitor, you must use the object object, otherwise you will not be able to monitor data changes.

Monitor data on the page

Guess you like

Origin blog.csdn.net/qq_30893717/article/details/133384999