当前位置:网站首页>Thirty What are VM and VC?

Thirty What are VM and VC?

2022-04-23 20:22:00 Isn't this more popular than Bo people?

(1) What is? vm? What is? vc?

  • VueComponent Instance object of , It will be abbreviated as vc( It can also be called : Component instance object ).
  • Vue Instance object of , It will be abbreviated as vm.

(2)VueComponent What is the essence of components ?

  • school The essence of a component is a component called VueComponent Constructor for , And not defined by programmers , yes Vue.extend Generated .
  • We just need to write or ,Vue When parsing, it will help us create school Component instance objects , namely Vue Help us execute :new VueComponent(options).
  • Particular attention : Every time you call Vue.extend, What is returned is a brand new VueComponent!!!!

(3) About this Point to :

  • vc In component configuration :data function 、methods The function in 、watch The function in 、computed The function in Their this It's all 【VueComponent Instance object 】.
  • new Vue(options) namely vm Configuration in progress :data function 、methods The function in 、watch The function in 、computed The function in Their this It's all 【Vue Instance object 】.

source : Shang Silicon Valley teacher Zhang Tianyu video , Talking about vm and vc An important built-in relationship of .

版权声明
本文为[Isn't this more popular than Bo people?]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204232021100386.html

随机推荐