From 1351560a9d0e45c205afeeaff91ab1905ed0cf13 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E9=AA=A5?= <1429614920@qq.com> Date: Thu, 12 Dec 2024 12:51:13 +0800 Subject: [PATCH 1/2] Update SelectTree.razor.cs --- src/BootstrapBlazor/Components/Select/SelectTree.razor.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs b/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs index 3d9c97131ff..ab901446cf6 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs +++ b/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs @@ -179,6 +179,10 @@ protected override async Task OnParametersSetAsync() // 组件未赋值 Value 通过 IsActive 设置默认值 await TriggerItemChanged(s => s.IsActive); } + { + // 组件已赋值 Value 通过 Value 设置默认值 + await TriggerItemChanged(s => Equals(s.Value, Value)); + } } /// From 0c2e93c9dca52f995f88c887b82c64ce93646e50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E9=AA=A5?= <1429614920@qq.com> Date: Thu, 12 Dec 2024 12:54:48 +0800 Subject: [PATCH 2/2] Update SelectTree.razor.cs --- src/BootstrapBlazor/Components/Select/SelectTree.razor.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs b/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs index ab901446cf6..a675e11e38f 100644 --- a/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs +++ b/src/BootstrapBlazor/Components/Select/SelectTree.razor.cs @@ -179,6 +179,7 @@ protected override async Task OnParametersSetAsync() // 组件未赋值 Value 通过 IsActive 设置默认值 await TriggerItemChanged(s => s.IsActive); } + else { // 组件已赋值 Value 通过 Value 设置默认值 await TriggerItemChanged(s => Equals(s.Value, Value));