Skip to content

Commit

Permalink
fix: 修复 required 合并问题
Browse files Browse the repository at this point in the history
  • Loading branch information
crazyair committed Aug 24, 2020
1 parent 23ed514 commit a889e6d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion packages/yforms/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yforms",
"version": "1.2.6",
"version": "1.2.7",
"description": "自定义表单组件",
"main": "lib/index.js",
"typings": "lib/index.d.ts",
Expand Down
6 changes: 4 additions & 2 deletions packages/yforms/src/YForm/scenes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ const scenes: YFormConfig = {
if (itemProps.name && typeProps.type && typeProps.type !== 'list') {
let hasRequired = false;
forEach(rules, (item) => {
hasRequired = 'required' in item;
if ('required' in item) {
hasRequired = true;
}
});
if (!hasRequired) {
_itemProps.rules = [
Expand All @@ -58,7 +60,7 @@ const scenes: YFormConfig = {
}
}
return {
itemProps: { ..._itemProps, ...itemProps },
itemProps: { ...itemProps, ..._itemProps },
};
},
},
Expand Down

0 comments on commit a889e6d

Please sign in to comment.