Skip to content

Commit

Permalink
fix: 开启extraName后,范围组件清空后必填校验无法生效 (baidu#11451)
Browse files Browse the repository at this point in the history
  • Loading branch information
hzh11012 authored and 2betop committed Jan 9, 2025
1 parent 26b5ad0 commit 3f72a97
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion packages/amis-core/src/store/formItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1523,7 +1523,13 @@ export const FormItemStore = StoreNode.named('FormItemStore')
| 'input' // 用户交互改变
| 'defaultValue' // 默认值
) {
self.tmpValue = value;
// 清除因extraName导致清空时value为空值数组,进而导致必填校验不生效的异常情况
if (self.extraName && Array.isArray(value)) {
self.tmpValue = value.filter(item => item).length ? value : '';
} else {
self.tmpValue = value;
}

if (changeReason) {
self.changeMotivation = changeReason;
}
Expand Down

0 comments on commit 3f72a97

Please # to comment.