javascript - I have been learning vue.js recently, and there is still a certain gap in my understanding of its parent and child components!
伊谢尔伦2017-05-24 11:36:46
0
3
688
I saw the api on the official website and this picture, but I don’t understand it very well. I feel that the components are similar to the custom instructions of angularjs..
The general meaning is that the child component and the parent component communicate with each other. The child component may call the parent component's method, but please do not let the child component depend on the parent component and cannot be used in other places
The parent component passes data to the child component through props, changes the state of the child component, etc. The child component passes the event to the parent component through events for further processing Reduces the coupling between components.
The biggest feeling that Vue’s components give me is that as long as you write it well, I will introduce the components that need to pass parameters into the page. Even if I don’t pass anything, the component will not report an error
The general meaning is that the child component and the parent component communicate with each other. The child component may call the parent component's method, but please do not let the child component depend on the parent component and cannot be used in other places
The parent component passes data to the child component through props, changes the state of the child component, etc.
The child component passes the event to the parent component through events for further processing
Reduces the coupling between components.
The biggest feeling that Vue’s components give me is that as long as you write it well, I will introduce the components that need to pass parameters into the page. Even if I don’t pass anything, the component will not report an error