Skip to content

Commit 1b52b9d

Browse files
committed
refactor: 重构代码
1 parent bd5e3ab commit 1b52b9d

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/BootstrapBlazor/Components/Select/Select.razor.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -390,9 +390,9 @@ private bool TryParseSelectItem(string value, [MaybeNullWhen(false)] out TValue
390390
SelectedItem? item = null;
391391
if (_result.Items != null)
392392
{
393-
item = _result.Items.FirstOrDefault(i => i.Value == value);
393+
item = _result.Items.FirstOrDefault(i => i.Value == value) ?? new SelectedItem(value, DefaultVirtualizeItemText ?? value);
394394
}
395-
return item ?? new SelectedItem(value, DefaultVirtualizeItemText ?? value);
395+
return item;
396396
}
397397

398398
/// <summary>

0 commit comments

Comments
 (0)