Skip to content

Commit 4fe87e9

Browse files
committed
doc: 更新 RadioList 示例
1 parent 6616a6f commit 4fe87e9

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,12 @@
1313
<ConsoleLogger @ref="Logger" />
1414
</DemoBlock>
1515

16+
<DemoBlock Title="@Localizer["RadiosAutoSelectFirstWhenValueIsNullTitle"]"
17+
Introduction="@Localizer["RadiosAutoSelectFirstWhenValueIsNullIntro"]"
18+
Name="AutoSelectFirstWhenValueIsNull">
19+
<RadioList TValue="string" Items="@AutoSelectValues" AutoSelectFirstWhenValueIsNull="false" />
20+
</DemoBlock>
21+
1622
<DemoBlock Title="@Localizer["RadiosDisableTitle"]"
1723
Introduction='@Localizer["RadiosDisableIntro"]'
1824
Name="Disable">

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

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ public sealed partial class Radios
1616
[NotNull]
1717
private IEnumerable<SelectedItem>? DemoValues { get; set; }
1818

19+
[NotNull]
20+
private IEnumerable<SelectedItem>? AutoSelectValues { get; set; }
21+
1922
[NotNull]
2023
private IEnumerable<SelectedItem>? DisableValues { get; set; }
2124

@@ -70,6 +73,12 @@ protected override void OnInitialized()
7073
new("2", Localizer["RadiosItem2"])
7174
};
7275

76+
AutoSelectValues = new List<SelectedItem>(2)
77+
{
78+
new("1", Localizer["RadiosItem1"]),
79+
new("2", Localizer["RadiosItem2"])
80+
};
81+
7382
DisableValues = new List<SelectedItem>(2)
7483
{
7584
new("1", Localizer["RadiosItem1"]),
@@ -177,6 +186,14 @@ private AttributeItem[] GetAttributes() =>
177186
Type = "IEnumerable<TItem>",
178187
ValueList = " — ",
179188
DefaultValue = "—"
189+
},
190+
new()
191+
{
192+
Name = "AutoSelectFirstWhenValueIsNull",
193+
Description = Localizer["RadiosAutoSelectFirstWhenValueIsNull"],
194+
Type = "bool",
195+
ValueList = "true|false",
196+
DefaultValue = "true"
180197
}
181198
];
182199

0 commit comments

Comments
 (0)