Before the interview time technology very natural to ask you know Vue have any characteristics, at that time did not understand Vue, Just to vue1.0 some knowledge to learn a little, and then casually said Vue can two-way binding data, now think really embarrassed Ah, vue2.0 has removed two-way binding, need to do it yourself to achieve. The following text:
Vue 2.x compared to Vue 1.x, there is a relatively large change is the removal of the components of the props two-way binding function.
The props twoway and. Sync binding modifiers are used in vue1.x to achieve props bidirectional binding functionality, but this functionality is completely discarded in vue2.x, which needs to be implemented if bidirectional binding is required.
In Vue2, the props data flow of a component is one-way, which is passed through the component's Dom property outside the component to the component, the component can only passively receive the data from the component, and within the component, the props data from the outer layer cannot be modified.
For example, two-way binding parent-child component data in Vue2, specific reference to the previous subassembly –> the parent component of the bus. $emit () method, the parent component can pass props to change the state on the child component Dom, while in the subassembly you want to change the state without directly modifying the parent component's data. Can only pass the changed state to the parent component, in the parent component by the parent component to receive the state of the child component to implement data changes, so that the parent-child component state two-way binding