Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

27. Vue.prototype.__init__ = function(){this?} #27

Open
ly525 opened this issue Feb 8, 2017 · 2 comments
Open

27. Vue.prototype.__init__ = function(){this?} #27

ly525 opened this issue Feb 8, 2017 · 2 comments
Labels

Comments

@ly525
Copy link
Owner

ly525 commented Feb 8, 2017

1. prototype的方法里面的this指的是Vue的实例吗?

需要再看一下prototype

回答是的, 这个相当与给所有的实例增加方法或者属性

@ly525
Copy link
Owner Author

ly525 commented Feb 17, 2017

2.this.constructor.options 中的this.constructor 需要再看一下高程

vm = new Vue()
vm.constructor === Vue // true
那么这么做的意义是什么呢? 为何要合并constructor中的options?

@ly525
Copy link
Owner Author

ly525 commented Feb 17, 2017

initData
proxy

initData

  1. 把options.data返回一个object对象作为vm._data;
  2. 如果options.data是function则执行, 并返回; 否则直接返回

@ly525 ly525 added Vue and removed Vue labels Jul 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant