Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 外地休假的物料UI TextField事件_Reactjs_Events_Event Handling_Material Ui_Textfield - Fatal编程技术网

Reactjs 外地休假的物料UI TextField事件

Reactjs 外地休假的物料UI TextField事件,reactjs,events,event-handling,material-ui,textfield,Reactjs,Events,Event Handling,Material Ui,Textfield,物料UI文本字段中是否存在离开字段或失去焦点的事件 我需要两个项目,一个是进场,一个是出场。输入该字段可以使用onFocus进行处理,但是否还有一个字段可以离开,即onFocusLost或onFocus?以下代码段显示了当前使用情况,缺少失去焦点的事件 <TextField value={this.state.fieldFirstName} onChange={(e: any) => this.onChangeFieldFirstName(e.target.value

物料UI文本字段中是否存在离开字段或失去焦点的事件

我需要两个项目,一个是进场,一个是出场。输入该字段可以使用
onFocus
进行处理,但是否还有一个字段可以离开,即
onFocusLost
onFocus
?以下代码段显示了当前使用情况,缺少失去焦点的事件

<TextField
    value={this.state.fieldFirstName}
    onChange={(e: any) => this.onChangeFieldFirstName(e.target.value)}
    onFocus={() => this.onFocusFieldFirstName()}
/>
this.onChangeFieldFirstName(e.target.value)}
onFocus={()=>this.onFocusFieldFirstName()}
/>
正在使用的版本:

  • 节点v13.8.0
  • npm 6.13.6
  • “@material ui/core”:“4.6.1”
  • “反应”:“16.11.0”
  • “react dom”:“16.11.0”
  • “@types/react”:“16.9.11”
  • @types/react-dom:“16.9.4”
this.onChangeFieldFirstName(e.target.value)}
onFocus={()=>this.onFocusFieldFirstName()}
onBlur={()=>this.onBlurField()}/>
使用onBlur事件这将解决您的问题

<TextField
value={this.state.fieldFirstName}
onChange={(e: any) => this.onChangeFieldFirstName(e.target.value)}
onFocus={() => this.onFocusFieldFirstName()}
onBlur={() => this.onBlurField()}/>