Skip to content

Commit 874a47a

Browse files
committed
feat(LinkButton): support IsAsync function
1 parent 526eb07 commit 874a47a

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/BootstrapBlazor/Components/Button/LinkButton.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,19 @@ private RenderFragment AddImage() => builder =>
120120

121121
private async Task OnClickButton()
122122
{
123-
if (OnClickWithoutRender != null)
123+
if (IsAsync)
124124
{
125-
await OnClickWithoutRender();
125+
IsAsyncLoading = true;
126+
IsDisabled = true;
126127
}
127128

128-
if (OnClick.HasDelegate)
129+
await HandlerClick();
130+
131+
// 恢复按钮
132+
if (IsAsync)
129133
{
130-
await OnClick.InvokeAsync();
134+
IsDisabled = IsKeepDisabled;
135+
IsAsyncLoading = false;
131136
}
132137
}
133138
}

0 commit comments

Comments
 (0)