{/*class中写方法*/}
inputOnBlur = ()=>{
this.setState({
isShowCheckBox:false
})
}
inputOnFocus = ()=> {
this.setState({
isShowCheckBox:true
})
}
{/*return中组件内容*/}
<Input placeholder="这是一个搜索框~"
prefix={<Icon type="search" style={{color: 'rgba(0,0,0,.25)'}}/>}
onPressEnter={this.startSearch}
onBlur={this.inputOnBlur }
onFocus={this.inputOnFocus }
/>
{isShowCheckBox &&<div className='Box' ></div> }
{/*prefix:带有前缀图标的 input*/}
{/*onPressEnter: 回车键触发事件*/}
{/*onBlur:失去焦点触发事件*/}
{/*onFocus:获得焦点触发事件*/}
获取焦点的效果:
失去焦点的效果: