在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問(wèn)答/HTML5  PHP  HTML/ react ant design mobile的表單怎么用的,怎獲取數(shù)據(jù)報(bào)錯(cuò)

react ant design mobile的表單怎么用的,怎獲取數(shù)據(jù)報(bào)錯(cuò)

 submit=(e)=>{
        e.preventDefault();
        let value=this.props.form.getFieldValue('key')+this.props.from.getFieldValue('replytext');
        alert(value);
    }
    render() {
        const { getFieldProps } = this.props.form;
        return (
            <div className="createreply-container">
                <WhiteSpace />
                <WhiteSpace />
                <form onSubmit={this.submit}>
             <WingBlank>
                 <List renderHeader={() => '關(guān)鍵詞'}>
                     <InputItem
                         {...getFieldProps('key')}
                         placeholder="請(qǐng)輸入關(guān)鍵字"
                     />
                 </List>
             </WingBlank>
                <WhiteSpace />
              <WingBlank>
                  <List renderHeader={() => '回復(fù)內(nèi)容'}>
                      <TextareaItem
                          {...getFieldProps('replytext', {
                              // initialValue: '請(qǐng)輸入回復(fù)內(nèi)容...',
                          })}
                          placeholder="請(qǐng)輸入回復(fù)內(nèi)容"
                          rows={5}
                          count={100}
                      />
                  </List>
              </WingBlank>
                <WhiteSpace />
                <WingBlank>
                    
                </WingBlank>
                <WhiteSpace size="lg"/>
                <WingBlank>
                    <Button type="primary"  onClick={this.submit}>完成</Button>
                    </WingBlank>
                </form>

部分代碼

出錯(cuò):
圖片描述

回答
編輯回答
心癌

摘抄三點(diǎn)ant design的文檔:

  1. [2.x] “Form 廢棄 getFieldProps,請(qǐng)使用 getFieldDecorator”,快速升級(jí).
  2. 注意:使用 getFieldsValue getFieldValue setFieldsValue 等時(shí),應(yīng)確保對(duì)應(yīng)的 field 已經(jīng)用 getFieldDecorator 注冊(cè)過(guò)了。

3.validateFields 校驗(yàn)并獲取一組輸入域的值與 Error,若 fieldNames 參數(shù)為空,則校驗(yàn)全部組件 Function([fieldNames: string[]], options: object, callback: Function(errors, values))

validateFieldsAndScroll 與 validateFields 相似,但校驗(yàn)完后,如果校驗(yàn)不通過(guò)的菜單域不在可見(jiàn)范圍內(nèi),則自動(dòng)滾動(dòng)進(jìn)可見(jiàn)范圍 參考 validateFields

2018年1月27日 02:15