Computed

This property can be associated with multiple objects that are evaluated in real time. This property can be triggered whenever one of these objects changes, so it will only be re-rendered if the data changes again, otherwise the data will be fetched directly from the cache.

For example, when we want todivWe can use it when the background color of the element matches the text colorcomputedProperties. At this timecomputedThis will only happen if the initial rendering and text color change. Other cases read directly from the cache.

Watch

Customizing the watch can be helpful when you need to perform asynchronous or high-performance operations in response to data changes.

Develop reading

  • “Advances in Vue (28) : A Brief Analysis of the Difference between Computed and Method in Vue”
  • Vue Advanced (Unitary Three Wood) : Dynamic Style Setting