Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/BootstrapBlazor/BootstrapBlazor.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.Razor">

<PropertyGroup>
<Version>10.3.1-beta05</Version>
<Version>10.3.1-beta06</Version>
</PropertyGroup>

<ItemGroup>
Expand Down
10 changes: 7 additions & 3 deletions src/BootstrapBlazor/Components/Select/Select.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -491,10 +491,14 @@ private async Task OnChange(ChangeEventArgs args)

private SelectedItem? GetItemByRows()
{
// 修复:使用完整的未过滤列表来查找当前选中项
// 避免在用户搜索时被外部 StateHasChanged 影响导致值被错误修改
var allItems = GetRowsByItems();

var item = GetItemWithEnumValue()
?? Rows.Find(i => i.Value == CurrentValueAsString)
?? Rows.Find(i => i.Active)
?? Rows.Find(i => !i.IsDisabled);
?? allItems.Find(i => i.Value == CurrentValueAsString)
?? allItems.Find(i => i.Active)
?? allItems.Find(i => !i.IsDisabled);
return item;
}
}