fix(form): 修复表单项隐藏逻辑错误

- 移除 Form.Item 组件内的隐藏判断逻辑
- 在 map 循环中提前返回 null 来隐藏表单项
- 确保隐藏的表单项不会渲染到 DOM 中
- 优化表单渲染性能,避免不必要的组件创建
master
LiuJiaNan 2026-04-30 14:25:43 +08:00
parent 90f394774f
commit 7de5add62b
2 changed files with 5 additions and 3 deletions

2
npm
View File

@ -4,3 +4,5 @@ https://www.npmjs.com/package/zy-react-library
# npm账号
liujianan15703339975
Ljn15703339975.
npm config set //registry.npmjs.org/:_authToken=你的令牌内容

View File

@ -431,9 +431,6 @@ const FormItemsRenderer = ({
delete formItemProps.dependencies;
delete formItemProps.shouldUpdate;
if (getHidden(option.hidden))
return null;
return (
<Col key={getKey(option) || index} span={col.span} style={style}>
<Form.Item
@ -646,6 +643,9 @@ const FormItemsRenderer = ({
return (
<>
{options.map((option, index) => {
if (getHidden(option.hidden))
return null;
const col = getCol(option);
const style = getStyle(index);
const formItemProps = getFormItemProps(option);