Skip to content

Commit 4b55508

Browse files
committed
doc: 增加示例
1 parent 8bec079 commit 4b55508

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/BootstrapBlazor.Server/Components/Samples/Selects.razor

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,13 @@
240240
<div class="col-12 col-sm-6 align-self-end">
241241
<div class="form-control">@SelectedEnumItem</div>
242242
</div>
243+
<div class="col-12 col-sm-6">
244+
<Select @bind-Value="_enumValueDemo" Items="_enumValueDemoItems" ShowLabel="true" DisplayText="@Localizer["SelectsEnumSelectText3"]">
245+
</Select>
246+
</div>
247+
<div class="col-12 col-sm-6 align-self-end">
248+
<div class="form-control">@_enumValueDemo</div>
249+
</div>
243250
</div>
244251
</DemoBlock>
245252

src/BootstrapBlazor.Server/Components/Samples/Selects.razor.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ public sealed partial class Selects
5151

5252
private string? _fooName;
5353

54+
private List<SelectedItem> _enumValueDemoItems = [
55+
new("0", "Primary"),
56+
new("1", "Middle")
57+
];
58+
59+
private EnumEducation _enumValueDemo = EnumEducation.Primary;
60+
5461
/// <summary>
5562
/// <inheritdoc/>
5663
/// </summary>
@@ -69,7 +76,7 @@ private async Task<QueryData<SelectedItem>> OnQueryAsync(VirtualizeQueryOption o
6976
var items = Foos;
7077
if (!string.IsNullOrEmpty(option.SearchText))
7178
{
72-
items = Foos.Where(i => i.Name!.Contains(option.SearchText, StringComparison.OrdinalIgnoreCase)).ToList();
79+
items = [.. Foos.Where(i => i.Name!.Contains(option.SearchText, StringComparison.OrdinalIgnoreCase))];
7380
}
7481
return new QueryData<SelectedItem>
7582
{

0 commit comments

Comments
 (0)