Skip to content

Commit 2fa34aa

Browse files
authored
fix(AutoComplete): do not show Items when set OnCustomFilter (#5053)
* fix: 无法显示数据问题 * chore: bump version 9.2.5
1 parent bb08bc6 commit 2fa34aa

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.2.5-beta02</Version>
4+
<Version>9.2.5</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

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)