更新1:我进一步删除了所有不必要的文件,你们能帮我https://codesandbox.io/s/0pk0z5prqn
https://codesandbox.io/s/q8o66x572w
tab-demo.js
constructor(props) {
super(props);
this.state = {
value: 0,
top: false,
left: false,
bottom: false,
right: false,
disabled: false
};
}
toggleDrawer = (side, open) => () => {
this.setState({
[side]: open
});
this.setState({ disabled: !this.state.disabled });
};
<Button onClick={this.toggleDrawer("right", true)}>
Advanced Sports Search
</Button>
sports-advanced-search.js
render() {
const { classes } = this.props;
const { value } = this.state;
console.log("this.state--->", this.state);
<input
name="firstname"
type="text"
disabled={this.state.disabled ? "disabled" : ""}
/>
答案 0 :(得分:2)
您不需要将“ disabled”作为字符串传递。禁用HTML的属性为boolean。因此,仅b
就足够了。