In some cases, we may need to “bidirectional bind” a prop. Unfortunately, true bidirectional binding creates maintenance problems, because a child component can change its parent, and there is no obvious source of change in either parent or child.

A few say that finish

First of all, we all know that in VUE, there are parent component to child component parameters, that is, parent to child, child to father, brother to pass

And sync is a syntactic candy that simplifies a few lines of code

What does he simplify? In fact, as we all know, PROP is a one-way data flow, only passed from father to child

The.sync is the syntactic sugar for the $emit statement

There is a confusion when you look at the documentation, the event is called (update:show). In the Vue documentation, it is just an extra colon, it is no different from the normal event name

That’s him. You can write anything you want, but he wrote it as a sign

Are all the same

Finally, use.sync

!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! To be clear, the child component will still trigger an event, send parameters, and the parent component will write it, and then there is the child parent, plus the parent parent, not the “bidirectional-binding “!!!!!!!!!!!!!!!!