Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

From 组件使用setFieldsValue方法进行赋值仅展示 显示异常 #1642

Closed
GleanCoder1116 opened this issue Mar 15, 2021 · 0 comments · Fixed by #1644
Closed

From 组件使用setFieldsValue方法进行赋值仅展示 显示异常 #1642

GleanCoder1116 opened this issue Mar 15, 2021 · 0 comments · Fixed by #1644
Labels
3.x bug Something isn't working comp:form

Comments

@GleanCoder1116
Copy link
Collaborator

在useEffect 中使用 setFieldsValue 方法进行赋值,仅展示第一个属性

const MasterDataScheme = () => {
  const basicForm = useRef()

  useEffect(() => {
    basicForm.current.setFieldsValue({ productCode: '1', productName: 'aaa' })
  }, [])

  return (
    <div>
      <div className={'content-container'}>
        <h3>基础信息</h3>
        <hr></hr>
        <div className={'content-container_basic'}>
          <Form ref={basicForm} labelWidth="80" labelPlacement="top">
            <FormItem required={true} label="产品编码" field="productCode">
              <Input placeholder="请输入" />
            </FormItem>
            <FormItem required={true} label="产品名称" field="productName">
              <Input placeholder="请输入" />
            </FormItem>
          </Form>
        </div>
      </div>
    </div>
  )
}

export default MasterDataScheme
@GleanCoder1116 GleanCoder1116 added bug Something isn't working 3.x labels Mar 15, 2021
GleanCoder1116 pushed a commit that referenced this issue Mar 17, 2021
GleanCoder1116 pushed a commit that referenced this issue Mar 17, 2021
GleanCoder1116 pushed a commit that referenced this issue Mar 17, 2021
GleanCoder1116 pushed a commit that referenced this issue Mar 17, 2021
chownchen added a commit that referenced this issue Mar 17, 2021
@GleanCoder1116 GleanCoder1116 linked a pull request Mar 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.x bug Something isn't working comp:form
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants