问题描述
我有一个添加了类装饰器的类。由于装饰器,静态方法和属性不可访问。在尝试访问该属性时,在该属性上获得 undefined
。
@BackInTimeWrapper()
class BarChart2 extends React.Component {
static staticValues = {
events: ["seriesClick"],};
render() {
return (<div>Sample</div>)
}
}
class NewChart extends React.Component<any> {
render() {
console.log("Static Props",BarChart2.staticValues); // getting undefined here
return (<BarChart2 {...this.props as any} />)
}
}
静态方法也是如此。是否应该在使用装饰器的类中不使用静态变量?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)