缺少类属性转换

Pet*_*hes 4 meteor reactjs

所以我刚刚尝试获取谷歌材料对话框.我对流星很新,反应如此,对我来说,answare对你来说可能更明显.

即使这样,我的控制台也给了我这个错误:

Missing class properties
   transform.
Run Code Online (Sandbox Code Playgroud)

在此文件的第16行:

export default class DialogExampleCustomWidth extends React.Component {

  state = {
    open: false,
  };

  handleOpen = () => {
    this.setState({open: true});
  };

  handleClose = () => {
    this.setState({open: false});
  };

  render() {
    const actions = [
      <FlatButton
        label="Cancel"
        primary={true}
        onTouchTap={this.handleClose}
      />,
      <FlatButton
        label="Submit"
        primary={true}
        onTouchTap={this.handleClose}
      />,
    ];

    return (
      <div>
        <RaisedButton label="Dialog With Custom Width" onTouchTap={this.handleOpen} />
        <Dialog
          title="Dialog With Custom Width"
          actions={actions}
          modal={true}
          contentStyle={customContentStyle}
          open={this.state.open}
        >
          This dialog spans the entire width of the screen.
        </Dialog>
      </div>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

错误出现在state = { 我已阅读多个articals但似乎无法得到它.谢谢你的帮助和时间

hen*_*enk 9

默认情况下,Meteor不支持箭头功能,但今天您只需更改:

添加以下包:

meteor npm install --save-dev babel-plugin-transform-class-properties
Run Code Online (Sandbox Code Playgroud)

在项目中编辑package.json并添加以下内容以使包工作:

 "babel": {
    "plugins": ["transform-class-properties"]

  }
Run Code Online (Sandbox Code Playgroud)