diff --git a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor index 15d92da4faccbdf9d2849928ca79422b1aa402d5..cbec21e5387cbf00de3325c576d0bcbdf5749699 100644 --- a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor +++ b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor @@ -61,7 +61,7 @@ - +
diff --git a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs index 31bb1096a43e21866940c36ac6acc39b38b91b0e..4b2ad6ddcb7e6551a4dc8d1229d0ea0bccffb7ed 100644 --- a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs +++ b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs @@ -66,11 +66,34 @@ namespace BootstrapBlazor.WebConsole.Pages } /// - /// + /// 根据Radio改变切换内容 /// private void OnRadioItemChanged(CheckboxState state, SelectedItem item) { - RadioDropDownItems.Add(new SelectedItem($"{RadioDropDownItems.Count()}", $"城市 {RadioDropDownItems.Count()}")); + var i = 0; + switch (item.Text) + { + case "北京": + RadioDropDownItems = new List() + { + new SelectedItem($"{i++}","东城区"), + new SelectedItem($"{i++}","西城区"), + new SelectedItem($"{i++}","朝阳区"), + new SelectedItem($"{i++}","丰台区"), + new SelectedItem($"{i++}",$"{System.DateTime.Now:HH:mm:ss}") + }; + break; + case "上海": + RadioDropDownItems = new List() + { + new SelectedItem($"{i++}","黄浦区"), + new SelectedItem($"{i++}","徐汇区"), + new SelectedItem($"{i++}","长宁区"), + new SelectedItem($"{i++}","静安区"), + new SelectedItem($"{i++}",$"{System.DateTime.Now:HH:mm:ss}") + }; + break; + } StateHasChanged(); } @@ -165,6 +188,6 @@ namespace BootstrapBlazor.WebConsole.Pages Description="下拉框值发生改变时触发", Type ="EventCallback" } - }; + }; } } diff --git a/src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs b/src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs index f6d0be0724890c2be0a19751781bd395c514080a..6c4995f72ec33651509fa86b4bc92097e81ce925 100644 --- a/src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs +++ b/src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs @@ -104,6 +104,7 @@ namespace BootstrapBlazor.Components await base.SetParametersAsync(parameters); if (Color == Color.None) Color = Color.Primary; + SelectedItem = Items.FirstOrDefault(); } } }