标签:用户 set user change input get setvalue UNC func
setValue(value,who) { var _this=this; console.log("this.setState是一个异步过程,即使放在回调里面也没用") this.setState({ [who]: value }); setTimeout(function(){ console.log( [who]+":"+_this.state[who]) },0) }
<TextInput placeholder="请输入用户名" ref="username" onChangeText={ (value,who) =>{this.setValue(value,"username")} }> </TextInput>
1.相当于封装一下 this.setState;
2.
react-native如何看待 this.setState()
标签:用户 set user change input get setvalue UNC func
原文地址:https://www.cnblogs.com/liuliu-hai/p/10355648.html