Skip to content

Commit 1e0ff04

Browse files
zglpzglpArgoZhang
authored
fix(Button): IsAsync parameter support wpf (#5878)
* fix(Button):修复WPF Blazor模式下Button组件IsAsync不工作 * chore: bump version beta03 Co-Authored-By: zglp <15925497+zglp@users.noreply.github.com> --------- Co-authored-by: zglp <2499728776@qq.com> Co-authored-by: Argo Zhang <argo@live.ca> Co-authored-by: zglp <15925497+zglp@users.noreply.github.com>
1 parent 6945375 commit 1e0ff04

4 files changed

Lines changed: 5 additions & 12 deletions

File tree

src/BootstrapBlazor/BootstrapBlazor.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.Razor">
22

33
<PropertyGroup>
4-
<Version>9.5.11-beta02</Version>
4+
<Version>9.5.11-beta03</Version>
55
</PropertyGroup>
66

77
<ItemGroup>

src/BootstrapBlazor/Components/Button/Button.razor.cs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
4040
}
4141

4242
/// <summary>
43-
/// OnClickButton 方法
43+
/// OnClickButton 方法
4444
/// </summary>
4545
protected virtual async Task OnClickButton()
4646
{
@@ -50,14 +50,7 @@ protected virtual async Task OnClickButton()
5050
IsDisabled = true;
5151
}
5252

53-
if (IsAsync)
54-
{
55-
await Task.Run(() => InvokeAsync(HandlerClick));
56-
}
57-
else
58-
{
59-
await HandlerClick();
60-
}
53+
await HandlerClick();
6154

6255
// 恢复按钮
6356
if (IsAsync && ButtonType == ButtonType.Button)

src/BootstrapBlazor/Components/Button/CountButton.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ protected override async Task OnClickButton()
3636
IsAsyncLoading = true;
3737
IsDisabled = true;
3838

39-
await Task.Run(() => InvokeAsync(HandlerClick));
39+
await HandlerClick();
4040
await UpdateCount();
4141

4242
IsDisabled = false;

src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private async Task OnClickConfirm()
9797
IsDisabled = true;
9898
IsAsyncLoading = true;
9999
StateHasChanged();
100-
await Task.Run(() => InvokeAsync(OnConfirm));
100+
await OnConfirm();
101101

102102
if (ButtonType == ButtonType.Submit)
103103
{

0 commit comments

Comments
 (0)