我有以下窗口小部件类:
var Widget = React.createClass({
statics: {title: "a title"},
...
});
有没有一种方法可以访问类的方法内部的静态标题(使用this
)?例如:
render: function() {
return <div>{this.title}</div>;
}
您可以从以下组件中访问静态this.constructor
:
因此在这种情况下将是:
this.constructor.title
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句