2022-10-15 nameList.map is not a function(react+antd form)
描述:react+antd form 表单报错:nameList.map is not a function。
原代码:
this.formRef.current.validateFields((e) => { console.log(e); });
原因:当前项目用到的antd版本为v4.0.0,而原代码的写法是v3.0.0以前的写法,不兼容导致。
解决方案:
this.formRef.current.validateFields().then((e) => { console.log(e); });