From 6feed5a01ea16c9a7b0387da65b40ba4476065ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E5=87=A1=E8=BE=BE?= Date: Thu, 30 Apr 2020 12:27:33 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=9B=B4=E6=94=B9Demo=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor | 2 +- .../Pages/Dropdowns.razor.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor index 15d92da4f..cbec21e53 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 31bb1096a..a05d4a469 100644 --- a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs +++ b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs @@ -70,7 +70,15 @@ namespace BootstrapBlazor.WebConsole.Pages /// private void OnRadioItemChanged(CheckboxState state, SelectedItem item) { - RadioDropDownItems.Add(new SelectedItem($"{RadioDropDownItems.Count()}", $"城市 {RadioDropDownItems.Count()}")); + var i = 0; + RadioDropDownItems = new List() + { + new SelectedItem($"{i++}","Make"), + new SelectedItem($"{i++}",".NET"), + new SelectedItem($"{i++}","Great"), + new SelectedItem($"{i++}","Again"), + new SelectedItem($"{i++}",$"{System.DateTime.Now:HH:mm:ss}") + }; StateHasChanged(); } -- Gitee From 4c18a557ecbd50bbad909e4cf19ad85a481745f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E5=87=A1=E8=BE=BE?= Date: Thu, 30 Apr 2020 13:16:33 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E4=BA=8E=20Drop?= =?UTF-8?q?down=20=E7=BB=84=E4=BB=B6=E7=9A=84=E7=AC=AC=E4=B8=80=E4=B8=AA?= =?UTF-8?q?=20item=20=E6=98=BE=E7=A4=BA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs b/src/BootstrapBlazor/Components/Dropdown/DropdownBase.cs index f6d0be072..6c4995f72 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(); } } } -- Gitee From 1174b4ff767753c3e8f679082e6bd86b5b9b0cfa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E5=87=A1=E8=BE=BE?= Date: Thu, 30 Apr 2020 13:28:57 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E6=9B=B4=E6=96=B0demo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Pages/Dropdowns.razor.cs | 33 ++++++++++++++----- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs index a05d4a469..4b2ad6ddc 100644 --- a/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs +++ b/src/BootstrapBlazor.WebConsole/Pages/Dropdowns.razor.cs @@ -66,19 +66,34 @@ namespace BootstrapBlazor.WebConsole.Pages } /// - /// + /// 根据Radio改变切换内容 /// private void OnRadioItemChanged(CheckboxState state, SelectedItem item) { var i = 0; - RadioDropDownItems = new List() + switch (item.Text) { - new SelectedItem($"{i++}","Make"), - new SelectedItem($"{i++}",".NET"), - new SelectedItem($"{i++}","Great"), - new SelectedItem($"{i++}","Again"), - new SelectedItem($"{i++}",$"{System.DateTime.Now:HH:mm:ss}") - }; + 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(); } @@ -173,6 +188,6 @@ namespace BootstrapBlazor.WebConsole.Pages Description="下拉框值发生改变时触发", Type ="EventCallback" } - }; + }; } } -- Gitee