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

Form Component with model props throws error #265

Open
shishiyong opened this issue Oct 18, 2021 · 1 comment
Open

Form Component with model props throws error #265

shishiyong opened this issue Oct 18, 2021 · 1 comment

Comments

@shishiyong
Copy link

shishiyong commented Oct 18, 2021

vue : 3.0.0
element-plus:1.0.2

code:

function renderFrom(h) {

const { formConfCopy } = this;
return (
  <el-row gutter={formConfCopy.gutter}>
    <el-form
      size={formConfCopy.size}
      label-position={formConfCopy.labelPosition}
      disabled={formConfCopy.disabled}
      label-width={`${formConfCopy.labelWidth}px`}
      ref={formConfCopy.formRef}
      props={{ model: this[formConfCopy.formModel] }}
      rules={this[formConfCopy.formRules]}
    >
      {renderFormItem.call(this, h, formConfCopy.fields)}
      {formConfCopy.formBtns && formBtns.call(this, h)}
    </el-form>
  </el-row>
);

}

props={{ model: this[formConfCopy.formModel] }} It doesn't work

just warning
[Element Warn][Form]model is required for validate to work!

@ding-js
Copy link

ding-js commented Dec 27, 2021

It seems that you should set props by spread operator like this

<el-form
  {...{
    props: {
      model: this[formConfCopy.formModel],
    },
  }}
>
  ...
</el-form>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants