alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
6.96k stars 986 forks source link

scrollToFirstError wrapForm.scrollToField is not a function #1451

Closed xyy7260 closed 8 months ago

xyy7260 commented 8 months ago

1.依赖仓库的版本(Dependencies versions)

"antd": "^5.6.4", "form-render": "2.3.6", "react": "^18.2.0", "react-dom": "^18.2.0"

2.问题描述(Bug description): 当我点击提交时候没有滚动到必填的地方

在表单属性中使用scrollToFirstError 报错 wrapForm.scrollToField is not a function

3.出现问题的 schema demo(Reproduction schema demo): 在codesandbox中

4.最小复现 demo(Reproduction demo)

form-render demo

lhbxs commented 8 months ago

XRender 的 form 虽然底层继承了 Antd 。但是 XRender 有 path 的概念和 Antd filed.name 所有不同。所以为了 防止 API 混用,所以在 API 上有自己独立的一套。

lhbxs commented 8 months ago

https://xrender.fun/form-render/api-props ,看下这个 通过 scrollToPath

xyy7260 commented 8 months ago
image

把props 属性传递到 自定组件最外层中就可以 滚动到错误地方了 scrollToField