搜索图标未使用Material-UI搜索

时间:2019-06-16 23:46:57

标签: reactjs frontend material-ui

我正在尝试触发搜索图标以对搜索栏中的结果开始搜索,但是它不起作用。单击它会显示其点击范围,但不会执行其他任何操作。谁能帮忙,谢谢

以下不是完整的代码,但超过了所需的代码。如果您需要完整的代码,请随时询问。

class OutlinedTextFields extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      searchA: false
    };

    this.searchOn = this.searchOn.bind(this);
  }
  searchOn() {
    this.setState({ active: true });
  }

  render() {
    const { classes } = this.props;

    return (
      <form className="conT" noValidate autoComplete="off">
        <TextField
          autoFocus={true}
          fullWidth
          className={`${classes.textField} without-padding`}
          InputLabelProps={{
            classes: {
              root: classes.cssLabel,
              focused: classes.cssFocused
            }
          }}
          InputProps={{
            classes: {
              root: classes.cssOutlinedInput,
              focused: classes.cssFocused,
              notchedOutline: classes.notchedOutline,
              MuiOutlinedInput: classes.MuiOutlinedInput
            }
          }}
          label="Search"
          variant="outlined"
          id="custom-css-outlined-input"
        />
        <InputAdornment disablePointerEvents={false}>
          <IconButton className={classes.style} onClick={this.searchOn}>
            <SearchIcon on Click={this.searchOn} />
          </IconButton>
        </InputAdornment>
      </form>
    );
  }
}

export default withStyles(styles)(OutlinedTextFields);

0 个答案:

没有答案