1、input事件会报错,因为事件合成
http://billqiu.github.io/2017/10/15/how-to-debounce-in-react/
普通写法
import debounce from 'lodash/debounce';
constructor(props) {
super(props);
this.debounceHandleChange = debounce(this.debounceHandleChange, 2000);
}
debounceHandleChange(value) {
console.log(value);
};
handleChange = (e) => {
e.persist();
this.debounceHandleChange(e.target.value)
//this.requestNodeListLatest(e.target.value);
};
修饰器写法
import { Debounce, Bind} from 'lodash-decorators';
@Debounce(2000)
debounceHandleChange(value) {
console.log(value);
};
handleChange = (e) => {
e.persist();
this.debounceHandleChange(e.target.value)
};
2、antd表单From的用法
第一种
const EditableFormRow = Form.create()(EditableRow);
第二种
@Form.create()
3、使用redux
@connect(({global}) => ({user:global.user}))
网友评论