Detailed answer: What impact do changes in Vue have on components?

亚连
Release: 2018-06-11 17:23:08
Original
1511 people have browsed it

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 */  
Copy after login
/** this is Children1.vue */  
Copy after login
/** this is Children2.vue */  
Copy after login
  1. Parent component Changing props. If a sub-component uses props directly, it will trigger an update of the sub-component.

  2. 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.

  3. 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

  4. 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 solve the problem of being unable to dynamically modify the URL address of the jqgrid component in vue

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn