所以我刚刚尝试获取谷歌资料对话框。 我对流星很新,反应如此,对我来说,answare对你来说可能更明显。
即便如此,我的控制台也给了我这个错误:
Missing class properties
transform.
在此文件的第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>
);
}
}
错误出现在state = {
上
我已阅读过多篇文章,但似乎无法理解。感谢您的帮助和时间
答案 0 :(得分:9)
默认情况下,Meteor不支持箭头功能,但今天你只需改变它:
meteor npm install --save-dev babel-plugin-transform-class-properties
在项目中编辑package.json,并在其中添加以下内容以生成the package work:
"babel": {
"plugins": ["transform-class-properties"]
}
答案 1 :(得分:0)
更改您的代码:
export default class DialogExampleCustomWidth extends React.Component {
consructor(props){
super(props);
this.state = {
open: false,
};
handleOpen = () => {
this.setState({open: true});
};
......
}
答案 2 :(得分:0)