Skip to content

Commit 3abaf29

Browse files
committed
fix: 无法显示数据问题
1 parent 0ea46bb commit 3abaf29

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/BootstrapBlazor/Components/AutoComplete/AutoComplete.razor.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ protected override void OnParametersSet()
115115
PlaceHolder ??= Localizer[nameof(PlaceHolder)];
116116
Icon ??= IconTheme.GetIconByKey(ComponentIcons.AutoCompleteIcon);
117117

118-
FilterItems = Items?.ToList() ?? [];
118+
FilterItems ??= Items?.ToList() ?? [];
119119
}
120120

121121
/// <summary>
@@ -145,9 +145,11 @@ public async Task TriggerOnChange(string val)
145145
else
146146
{
147147
var comparison = IgnoreCase ? StringComparison.OrdinalIgnoreCase : StringComparison.Ordinal;
148-
var items = IsLikeMatch
149-
? Items.Where(s => s.Contains(val, comparison))
150-
: Items.Where(s => s.StartsWith(val, comparison));
148+
var items = string.IsNullOrEmpty(val)
149+
? Items
150+
: IsLikeMatch
151+
? Items.Where(s => s.Contains(val, comparison))
152+
: Items.Where(s => s.StartsWith(val, comparison));
151153
FilterItems = items.ToList();
152154
}
153155

0 commit comments

Comments
 (0)