1. 程式人生 > >ant design pro 表單預設值

ant design pro 表單預設值

除錯時免去頻繁輸入值可以設定輸入框預設值,設定initialValue:

          <FormItem>
            {getFieldDecorator('mail', {initialValue: '[email protected]',
              rules: [
                {
                  required: true,
                  message: formatMessage({ id: 'validation.email.required' }),
                },
                {
                  type: 'email',
                  message: formatMessage({ id: 'validation.email.wrong-format' }),
                },
              ],
            })(
              <Input size="large" placeholder={formatMessage({ id: 'form.email.placeholder' })} />
            )}
          </FormItem>