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表单resetFields没有触发onValuesChange #570

Open
1 task done
findever opened this issue Mar 11, 2019 · 4 comments
Open
1 task done

form表单resetFields没有触发onValuesChange #570

findever opened this issue Mar 11, 2019 · 4 comments

Comments

@findever
Copy link

findever commented Mar 11, 2019

  • I have searched the issues of this repository and believe that this is not a duplicate.

Version

undefined

Environment

ant-design-vue 1.3.5

Reproduction link

Edit on CodeSandbox

Steps to reproduce

createForm时传递了onValuesChange,但是在调用表单的resetFields方法时,不会回调onValuesChange处理,导致外部脏数据

What is expected?

回调onValuesChange

What is actually happening?

未回调onValuesChange

@tangjinzhou
Copy link
Member

是不会回调的,数据流如此,UI交互导致的数据更改才会触发onValuesChange,手动reset和set都不会触发

@findever
Copy link
Author

是不会回调的,数据流如此,UI交互导致的数据更改才会触发onValuesChange,手动reset和set都不会触发

@tangjinzhou 手动setFieldsValue会触发,表单的reset不会,按我的理解是,onValuesChange表示值表更了都会进行通知,不然这个变更监听就没什么意义了(无法捕获到所有的变更)?

@yxmg
Copy link

yxmg commented Feb 5, 2021

是不会回调的,数据流如此,UI交互导致的数据更改才会触发onValuesChange,手动reset和set都不会触发

@tangjinzhou 手动setFieldsValue会触发,表单的reset不会,按我的理解是,onValuesChange表示值表更了都会进行通知,不然这个变更监听就没什么意义了(无法捕获到所有的变更)?

是的,同样遇到了这个问题。业务中经常有通过表单值change去做表单联动 比如去控制其他控件显隐,set和reset改变了数据,但无法通过change捕获到value的所有变更,这让我很困惑
目前解决方案是在模板中通过form.getFieldValue('xxx')去绑定,这样可以捕获到所有变更

@TORYOI
Copy link

TORYOI commented May 8, 2024

太怪了

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

No branches or pull requests

4 participants