Element: [Bug Report] el-form.resetFields() not work when form model has its value in created() function

Created on 17 Dec 2018  ·  4Comments  ·  Source: ElemeFE/element

Element UI version

2.4.11

OS/Browsers version

Win10 1803/ Chrome 71.0.3578.98 32bit

Vue version

2.5.21

Reproduction Link

https://jsfiddle.net/tbkdnj6x/

Steps to reproduce

  1. click the reset button

What is Expected?

No matter when the form model has its value, el-from.resetFields() should empty the model.

What is actually happening?

el-form.resetFields() will not reset the form-item.value if the value is set in created() function

Most helpful comment

It works if you give value to form model field in mounted() function. see here

If cannot or no plan to fix the issue I discribed above, I would close this issue.

All 4 comments

Even when you delete the test string in the first input component manually, then click the reset button, you will see the test string AGAIN!

It works if you give value to form model field in mounted() function. see here

If cannot or no plan to fix the issue I discribed above, I would close this issue.

It works if you give value to form model field in mounted() function. see here

If cannot or no plan to fix the issue I discribed above, I would close this issue.

You didn't give prop for all the el-form-item. For resetting the form prop is mandatory for all the el-form-item.

It works if you give value to form model field in mounted() function. see here

If cannot or no plan to fix the issue I discribed above, I would close this issue.

I think this is not documented feature. I think that form take default model in created hook and you can use this feature for forms with default fields data.

Was this page helpful?
0 / 5 - 0 ratings