Input
— import { Space, Inputge } from ‘antd’;
<Space size={8} direction="vertical">
<Input maxLength={50} ref={condition} placeholder={props.placeholder} />
<Space size={8}>
<Button type="primary" onClick={treeReq}>
</Button>
<Button type="primary" onClick={reset}>
</Button>
</Space>
</Space>;
treeReq()
—reset()
const treeReq = () => {
console.log('获取value值',condition.current.input.value)
const reset = () => {
condition.current.setState({ value: '' });
设置input值
condition.current.setState({ value: ‘’ });
ref写法二:
ref={(e)=>(condition=e)}
ref这种写法可以省去current
,例如:
condition.input.value