Usage of sync modifier in Vue components

The parent component uses the child component to pass the parameter title value to the child component, which is the message bound to the parent component.

Want to change the corresponding value in the parent component in the child component

<cpn-one :title.sync="message"></cpn-one>

 In the child component, you can directly emit events through $emit to change the corresponding value in the parent component, simplifying the operation.

 this.$emit('update:title','子组件修改父组件messagesync')

Guess you like

Origin blog.csdn.net/uniquepeng/article/details/132469466