Skip to content

Commit

Permalink
fix: 修复数组子项为空,当前项自动被删除问题 (#128)
Browse files Browse the repository at this point in the history
  • Loading branch information
mengshang918 committed Jan 20, 2022
1 parent 6c6bec8 commit 5c8e66b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions packages/hooks/src/useField.ts
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,16 @@ const useField = (
...options,
})
}
// 删除formData中相应表单字段(fix:表单唯恐之后必填校验失效)
// 删除dataSchema中相应default(fix: text默认值后续删除不自动添加 #C2020091124826)
/**
* 删除formData中相应表单字段(fix:表单为空之后必填校验失效)
* 删除dataSchema中相应default(fix: text默认值后续删除不自动添加)
* 数组容器中子项为空不删除
*/
if (
Object.prototype.hasOwnProperty.call(options, 'isDelete')
(Object.prototype.hasOwnProperty.call(options, 'isDelete')
? options.isDelete
: isEmpty(value)
: isEmpty(value)) &&
getKey(fieldKey, 'dataSchema').split('.').pop() !== 'items'
) {
dispatch({
type: 'deleteFormData',
Expand Down

0 comments on commit 5c8e66b

Please sign in to comment.