antd4.x表单中使用getValueFromEvent
禁止输入空格
<Form.Item label="xxx" name="xxxxx"
getValueFromEvent={ event => event.target.value.trim()}
rules={[
{ pattern: new RegExp(/^[\u4E00-\u9FA5A-Za-z0-9]+$/, "g"), message: '请输入xxx,支持中英文、数字' },
{ required: false, message: '请输入xxx' }
]}>
<Input maxLength={50} placeholder="请输入xxx" />
</Form.Item>