We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
ESNext 是无法声明 prototype property 的。所以,对于 template / filters / components 等属性,San 提供了 static property 的支持。
实际上不嫌难看的话,可以用ESNext这么搞:
class HelloComponent { get template() { return '<p>Hello {{name}}!</p>'; } initData() { return {name: 'San'} } } // test HelloComponent.prototype.template && console.log(HelloComponent.prototype.template)
The text was updated successfully, but these errors were encountered:
现在 san 是通过支持类的静态成员来支持的:
class MyComponent extends san.Component { static template = ` <div>xxxx</div> `; }
当然,需要你自己给 babel 加上插件或者相应的 preset。
Sorry, something went wrong.
san是这样做了没错,只是文档描述ESNext可能不很妥当
我们并不建议使用 get 来搞。至于描述,我没看出不妥当在哪。static 虽然没有任何运行环境支持,但也属于 ESNext 的一部分。 https://github.com/tc39/proposal-class-fields
如果 @ayqy 觉得不恰当的话,可以在 san-website 的 repo 提 pull-request 咯,这个 issue 我就关了
No branches or pull requests
实际上不嫌难看的话,可以用ESNext这么搞:
The text was updated successfully, but these errors were encountered: