更新1 :我进一步删除了所有不必要的文件,你们能帮我https://codesandbox.io/s/0pk0z5prqn吗?
https://codesandbox.io/s/q8o66x572w
选项卡-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" : ""}
/>发布于 2019-01-17 00:36:34
您不需要将“禁用”作为字符串传递。HTML禁用属性是布尔属性。所以,只要disabled={this.state.disabled}就够了。
https://stackoverflow.com/questions/54227395
复制相似问题