import classNames from 'classnames'; constructor(props) { super(props); this.state = { ... index: 0, }; } handleClick (index) { // toggle效果你可以先判定是否等同,然后设置为-1 this.setState({index}); } render() { some.map((item ,idx) => { return ( <li className={ classNames({active: idx === this.state.index}) } onClick={ this.handleClick.bind(this, idx) }></li> ) }) }