Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 开启extraName后,范围组件清空后必填校验无法生效 #11451

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading