超类构造函数调用应该在构造函数体中
Superclass constructor invocation should be in constructor body
我写React class constructor use es6, 但是webstorm9编辑器出现红色高亮错误
这是代码的一部分:
class AssetSelectDialog extends React.Component {
static propTypes = {
data: React.PropTypes.any,
pageState: React.PropTypes.string,
pageStatus: React.PropTypes.string,
handleCancel: React.PropTypes.func,
handleSave: React.PropTypes.func
};
constructor(props) {
super(props);
this.PAGE_STATUS = {
SHOW: 'SHOW',
SELECT: 'SELECT'
};
this.state = {
data: this.props.data || {},
pageState: this.props.pageState || CONST.STATUS.EDIT,
pageStatus: this.props.pageStatus || this.PAGE_STATUS.SHOW
};
}
在 super(props);
中发现错误,消息是 Superclass constructor invocation should be in constructor body
。
代码在 babel 中 运行 正常。我该如何修复它?
这是 WebStorm 中的错误,WEB-14601 已在 WebStorm 10.0.4 中修复
我写React class constructor use es6, 但是webstorm9编辑器出现红色高亮错误 这是代码的一部分:
class AssetSelectDialog extends React.Component {
static propTypes = {
data: React.PropTypes.any,
pageState: React.PropTypes.string,
pageStatus: React.PropTypes.string,
handleCancel: React.PropTypes.func,
handleSave: React.PropTypes.func
};
constructor(props) {
super(props);
this.PAGE_STATUS = {
SHOW: 'SHOW',
SELECT: 'SELECT'
};
this.state = {
data: this.props.data || {},
pageState: this.props.pageState || CONST.STATUS.EDIT,
pageStatus: this.props.pageStatus || this.PAGE_STATUS.SHOW
};
}
在 super(props);
中发现错误,消息是 Superclass constructor invocation should be in constructor body
。
代码在 babel 中 运行 正常。我该如何修复它?
这是 WebStorm 中的错误,WEB-14601 已在 WebStorm 10.0.4 中修复