react中事件绑定需要用到onClick来绑定点击事件。

一般直接写:

  handleSubmitForm  = e => {
    // 方法内处理
  }
          
  // render方法

  <Button onClick={this.handleFunction} >上一步</Button>

当需要传参时,有两种写法,如下:

              handleGuide = (item) => {
          // 内部方法,处理数据
        }


// render 方法
          this.oprateListNew2.map((item,index)=>( <div key={index} onClick={this.handleGuide.bind(this, item)} // 方法1 // onClick={() => this.handleGuide(item)} // 方法2 > <Tag color="#E59104" style={{ position: 'absolute', top: 0,left: 0 }} >{index>4?'待上线':'已上线'}</Tag> <h4 style={{color: '#fff'}}>{item.title}</h4> </div> ))

 

相关文章:

  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2021-10-02
  • 1970-01-01
  • 2021-08-27
  • 2021-06-14
  • 2021-12-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-25
  • 2021-11-20
  • 2021-10-09
相关资源
相似解决方案