Vue some comparative

Disclaimer: If you have any objection to this article, then please write your comments in the article comments at. If you find this article interesting, please share and forward, or you can look at, you acknowledge and encouragement of our articles. Wish everyone in the programming this road, farther and farther. https://blog.csdn.net/weixin_44369568/article/details/91488849

Vue some comparative

A, methods and computed

  • computed is computed attribute, methods method.
  • It is computed based on the computed attribute for their dependenciesCacheof
  • computed only when its associated changes will depend re-evaluated
  • As for the method, as long as the occurrence of re-rendering, method invocationFederationExecution of the function
  • Using methods each time you do need to reload, do not need to cache; large amount of data needs to be cached when using computed: short

Two, computed and watch

  • Property is calculatedComputed PropertyListener watchA listener watch
  • Listener is listening watch a specific value, a specific function is executed when the value change

three, r o u t e r router and route

  • VueRouter router is an example of a global router corresponding to the object, which contains a lot of attributes and sub-objects
  • route routing object that is currently equivalent to jump. . You can get name, path, params, query and so on from the inside
  • Print this. r o u t e t h i s . route和this. router,Two simultaneous presence
  • Parameter passing both the same manner

Guess you like

Origin blog.csdn.net/weixin_44369568/article/details/91488849