vueComponent / ant-design-vue

🌈 An enterprise-class UI components based on Ant Design and Vue. 🐜
https://antdv.com/
Other
20.2k stars 3.79k forks source link

a-form-item包裹a-row时,获取不到表单值 #240

Closed dongnaebi closed 5 years ago

dongnaebi commented 5 years ago

Version

1.1.7

Environment

all new

Reproduction link

http://sorry.com

Steps to reproduce

<a-form-item fieldDecoratorId="verifyCode" :fieldDecoratorOptions="{rules: [{ required: true, message: '请输入短信验证码', whitespace: true}]}">
  <a-row>
    <a-col :span="16">
      <a-input size="large" placeholder="短信验证码">
        <a-icon slot="prefix" type="code-o" />
      </a-input>
    </a-col>
    <a-col :span="8">
      <a-button size="large" class="margin-left" :disabled="sendText!='获取验证码'&&sendText!='重新获取'" @click="sendCode">{{sendText}}</a-button>
    </a-col>
  </a-row>
</a-form-item>
console.log(this.form.getFieldValue('verifyCode')) // undefined

并且表单非空验证也通不过

What is expected?

可以获取到值

What is actually happening?

试了其他元素,input被div和a-card包裹时,都能正常获取到,1.1.6也存在这个问题

tangjinzhou commented 5 years ago

https://vuecomponent.github.io/ant-design-vue/components/form-cn/#autoFormCreate image 另外:为啥还要用a-row a-col包裹,本身form-item就可以满足这些布局需求

dongnaebi commented 5 years ago

thx

github-actions[bot] commented 4 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.