<input type="number" placeholder='请输入数字' id='priceValueInput' value={this.state.priceValueInput || ''} onChange={this.inputChange.bind(this)}/>
 inputChange(evt) {
    let obj = {}
    let value = evt.target.value
    let type = document.getElementById(evt.target.id).type
    if(type == 'number') {
      value = (value.match(/^\d*(\.?\d{0,2})/g)[0]) || null
    }
    obj[evt.target.id] = value
    this.setState(obj)
  }

 

相关文章:

  • 2021-11-16
  • 2022-12-23
  • 2021-06-06
  • 2021-05-20
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案