Skip to content

Commit c9eadaf

Browse files
committed
feat: 增加 TriggerLoaded 回调方法
1 parent 88ef569 commit c9eadaf

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/BootstrapBlazor/Components/IFrame/IFrame.razor.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ public partial class IFrame
2828
[Parameter]
2929
public Func<object?, Task>? OnPostDataAsync { get; set; }
3030

31+
/// <summary>
32+
/// 获得/设置 页面加载完毕后回调方法
33+
/// </summary>
34+
[Parameter]
35+
public Func<Task>? OnReadyAsync { get; set; }
36+
3137
private string? ClassString => CssBuilder.Default("bb-frame")
3238
.AddClassFromAttributes(AdditionalAttributes)
3339
.Build();
@@ -75,4 +81,17 @@ public async Task TriggerPostData(object? data)
7581
await OnPostDataAsync(data);
7682
}
7783
}
84+
85+
/// <summary>
86+
/// 由 JavaScript 调用
87+
/// </summary>
88+
/// <returns></returns>
89+
[JSInvokable]
90+
public async Task TriggerLoaded()
91+
{
92+
if (OnReadyAsync != null)
93+
{
94+
await OnReadyAsync();
95+
}
96+
}
7897
}

0 commit comments

Comments
 (0)