Skip to content

Commit 9ecff37

Browse files
committed
refactor: 增加条件判断
1 parent 8a9748e commit 9ecff37

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/BootstrapBlazor/Components/ValidateForm/ValidateForm.razor.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
using Microsoft.AspNetCore.Components.Forms;
77
using Microsoft.Extensions.Localization;
8+
using System.Collections;
89
using System.Collections.Concurrent;
910
using System.Linq.Expressions;
1011
using System.Reflection;
@@ -508,7 +509,10 @@ private async Task ValidateAsync(IValidateComponent validator, ValidationContext
508509
else
509510
{
510511
// 未选择文件
511-
propertyValue = null;
512+
if (propertyValue is IEnumerable)
513+
{
514+
propertyValue = null;
515+
}
512516
ValidateDataAnnotations(propertyValue, context, messages, pi);
513517
}
514518

0 commit comments

Comments
 (0)