Skip to content

Commit 25d72d0

Browse files
ArgoZhangzglp
andauthored
fix(Button): IsAsync parameter support wpf (#5878) (#5890)
* fix(Button):修复WPF Blazor模式下Button组件IsAsync不工作 * chore: bump version beta03 Co-Authored-By: zglp <[email protected]> --------- Co-authored-by: zglp <[email protected]> Co-authored-by: Argo Zhang <[email protected]> Co-authored-by: zglp <[email protected]> # Conflicts: # src/BootstrapBlazor/BootstrapBlazor.csproj # src/BootstrapBlazor/Components/Button/PopConfirmButton.razor.cs Co-authored-by: zglp <[email protected]>
1 parent 9f0d084 commit 25d72d0

File tree

3 files changed

+3
-14
lines changed

3 files changed

+3
-14
lines changed

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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 & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,7 @@ private async Task OnClickConfirm()
9999
IsDisabled = true;
100100
IsAsyncLoading = true;
101101
StateHasChanged();
102-
103-
if (OnConfirm != null)
104-
{
105-
await Task.Run(() => InvokeAsync(OnConfirm));
106-
}
102+
await OnConfirm();
107103

108104
if (ButtonType == ButtonType.Submit)
109105
{

0 commit comments

Comments
 (0)