This article mainly introduces a brief discussion of the impact of vue's props, data, and computed changes on component updates. Now I will share it with you and give you a reference.
This article introduces the impact of changes in vue's props, data, and computed on component updates. I would like to share it with you. Without further ado, let’s go directly to the code.
/** this is Parent.vue */
{{'parent data : ' + parentData}}
{{'parent to children1 props : ' + parentToChildren1Props}}
{{'parent to children2 props : ' + parentToChildren2Props}}
change parent data change parent to children1 data change parent to children2 data
/** this is Children1.vue */
{{'children1 data : ' + children1Data}}
{{'parent to children1 props : ' + children1Props}}
{{'parent to children1 props to data : ' + children1PropsData}}
change children1 data emit parent to change children1 props
/** this is Children2.vue */
{{'children2 data : ' + children2Data}}
{{'parent to children2 props : ' + children2Props}}
{{'parent to children2 props to data : ' + children2PropsData}}
change children2 data emit parent to change children2 props
Parent component Changing props. If a sub-component uses props directly, it will trigger an update of the sub-component.
The parent component changes props. If a sub-component puts props into data and then uses it, it will not trigger an update of the sub-component.
The parent component changes props, and if the sub-component puts the props into computed and then uses it, it will trigger the sub-component to update
data, props and Changes in computed will trigger component updates
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Use cheerio to make a simple web crawler in Node.js (detailed tutorial)
How to do it in vue Implement the parent component to pass multiple data to the child component
How to use Native in React to implement a custom pull-down refresh pull-up loaded list
How to achieve a similar Taobao star rating in vue
The above is the detailed content of Detailed answer: What impact do changes in Vue have on components?. For more information, please follow other related articles on the PHP Chinese website!