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表单手动设置值没有重置校验状态 #1987

Closed
zmm2tysu opened this issue Mar 6, 2024 · 2 comments · Fixed by #2400
Closed

Form表单手动设置值没有重置校验状态 #1987

zmm2tysu opened this issue Mar 6, 2024 · 2 comments · Fixed by #2400
Assignees

Comments

@zmm2tysu
Copy link

zmm2tysu commented Mar 6, 2024

NutUI React 包名

@nutui/nutui-react

NutUI React 版本号

2.3.12

平台

h5, weapp, alipay, jd, tt

重现链接

https://codesandbox.io/p/sandbox/jin-yong-antd-5-12-4-forked-tc2xsk?layout=%257B%2522sidebarPanel%2522%253A%2522EXPLORER%2522%252C%2522rootPanelGroup%2522%253A%257B%2522direction%2522%253A%2522horizontal%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522id%2522%253A%2522ROOT_LAYOUT%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522UNKNOWN%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522cltf5vfeh0007356k2kkibtfp%2522%252C%2522sizes%2522%253A%255B100%252C0%255D%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522EDITOR%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522EDITOR%2522%252C%2522id%2522%253A%2522cltf5vfeh0003356kocbn24qf%2522%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522direction%2522%253A%2522horizontal%2522%252C%2522id%2522%253A%2522SHELLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522SHELLS%2522%252C%2522id%2522%253A%2522cltf5vfeh0004356kbra3ufb6%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%257D%252C%257B%2522type%2522%253A%2522PANEL_GROUP%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522direction%2522%253A%2522vertical%2522%252C%2522id%2522%253A%2522DEVTOOLS%2522%252C%2522panels%2522%253A%255B%257B%2522type%2522%253A%2522PANEL%2522%252C%2522contentType%2522%253A%2522DEVTOOLS%2522%252C%2522id%2522%253A%2522cltf5vfeh0006356ksjln7ms0%2522%257D%255D%252C%2522sizes%2522%253A%255B100%255D%257D%255D%252C%2522sizes%2522%253A%255B50%252C50%255D%257D%252C%2522tabbedPanels%2522%253A%257B%2522cltf5vfeh0003356kocbn24qf%2522%253A%257B%2522tabs%2522%253A%255B%257B%2522id%2522%253A%2522cltf5vfeh0002356khx4gq8zi%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522type%2522%253A%2522FILE%2522%252C%2522initialSelections%2522%253A%255B%257B%2522startLineNumber%2522%253A3%252C%2522startColumn%2522%253A27%252C%2522endLineNumber%2522%253A3%252C%2522endColumn%2522%253A27%257D%255D%252C%2522filepath%2522%253A%2522%252Fdemo.tsx%2522%252C%2522state%2522%253A%2522IDLE%2522%257D%255D%252C%2522id%2522%253A%2522cltf5vfeh0003356kocbn24qf%2522%252C%2522activeTabId%2522%253A%2522cltf5vfeh0002356khx4gq8zi%2522%257D%252C%2522cltf5vfeh0006356ksjln7ms0%2522%253A%257B%2522id%2522%253A%2522cltf5vfeh0006356ksjln7ms0%2522%252C%2522activeTabId%2522%253A%2522cltf61u1i00g1356kxmsd3jnw%2522%252C%2522tabs%2522%253A%255B%257B%2522type%2522%253A%2522UNASSIGNED_PORT%2522%252C%2522port%2522%253A0%252C%2522id%2522%253A%2522cltf61u1i00g1356kxmsd3jnw%2522%252C%2522mode%2522%253A%2522permanent%2522%252C%2522path%2522%253A%2522%252F%2522%257D%255D%257D%252C%2522cltf5vfeh0004356kbra3ufb6%2522%253A%257B%2522tabs%2522%253A%255B%255D%252C%2522id%2522%253A%2522cltf5vfeh0004356kbra3ufb6%2522%257D%257D%252C%2522showDevtools%2522%253Atrue%252C%2522showShells%2522%253Afalse%252C%2522showSidebar%2522%253Atrue%252C%2522sidebarPanelSize%2522%253A15.729166666666671%257D

重现步骤

  1. 先点击提交触发校验
  2. 再点击手动设置值按钮

期望的结果是什么?

校验通过

实际的结果是什么?

校验没有通过

环境信息

No response

其他补充信息

我是在taro项目中用@nutui/nutui-react-taro v2.3.11 发现的问题,复现链接是用的@nutui/nutui-react 也能复现

@zmm2tysu
Copy link
Author

zmm2tysu commented Mar 6, 2024

另外请问Form.Item下无法用View包裹Input吗?场景是在末尾添加一个单位label,但是我用View包裹后,Input值就不受表单控制了。

@boiboif
Copy link
Contributor

boiboif commented Mar 27, 2024

另外请问Form.Item下无法用View包裹Input吗?场景是在末尾添加一个单位label,但是我用View包裹后,Input值就不受表单控制了。

你这种属于自定义表单控件的场景,FormItem会给子组件添加value属性和onChange事件,你自己在组件内部处理就行了

@Alex-huxiyang Alex-huxiyang self-assigned this Jul 1, 2024
@Alex-huxiyang Alex-huxiyang pinned this issue Jul 1, 2024
@Alex-huxiyang Alex-huxiyang linked a pull request Jul 1, 2024 that will close this issue
1 task
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

Successfully merging a pull request may close this issue.

3 participants