小编S J*_*S J的帖子

在reactjs中访问onChange字段时输入字段目标为空

即使我为名称和值字段分配值,event.target 也会变为空。event.target.value 正在获得价值,但没有获得任何其他价值。

    <input type= "text" 
       name= {value}
       value = {currentValue}
       onChange = { (e) => this.onInputChanged(e) } 
       disabled = { disabled }
    />

    onInputChanged = async (e) => {
       await this.setState({ currentValue: e.target.value })
       console.log('event', e.target);    //This is showing null
       this.props.onInputChange(e);
    }
Run Code Online (Sandbox Code Playgroud)

html javascript reactjs

11
推荐指数
1
解决办法
6943
查看次数

标签 统计

html ×1

javascript ×1

reactjs ×1