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

关于Vue构造函数没有使用ES6的Class语法 #53

Open
monking92 opened this issue Apr 20, 2019 · 3 comments
Open

关于Vue构造函数没有使用ES6的Class语法 #53

monking92 opened this issue Apr 20, 2019 · 3 comments

Comments

@monking92
Copy link

在Vue构造函数那段说,不用class是方便Vue按功能分散到多个模块对prototype进行扩展,而class难以实现,这里不太明白。class应该只是语法糖,对class的prototype也是可以扩展的,而且效果一样。不明白有何区别,还请老师指点

@ustbhuangyi
Copy link
Owner

class 是语法糖没错,但是通常你去用 class 的语法去实现一个类的时候是在一个文件中定义的吧,我很少见到 class 和 prototype 混用的情况。

@monking92
Copy link
Author

也就是说从语法形式上来说,使用Function更加符合?

@zhangenming
Copy link

为了之后在各个文件加载Vue.prototype.*属性
不然class 和prototype混用 很尴尬

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants