Taro button点击切换选中状态

一、引入组件this

二、state中设置选中状态3d

  // button按钮的默认选中,0表明选中
  state = {
    currentIndex: 0
  }
三、设置class的样式,点击更改选中
  selectNew(){
    this.setState({currentIndex:0});
  }
  selectOld(){
    this.setState({currentIndex:1});
  }
相关文章
相关标签/搜索