Skip to content

Commit 6f7ec52

Browse files
committed
feat: 优化性能减少因此数据推送
1 parent 7223483 commit 6f7ec52

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

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

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,16 @@ public partial class IFrame
4040

4141
private object? _lastData;
4242

43+
/// <summary>
44+
/// <inheritdoc/>
45+
/// </summary>
46+
protected override void OnInitialized()
47+
{
48+
base.OnInitialized();
49+
50+
_lastData = Data;
51+
}
52+
4353
/// <summary>
4454
/// <inheritdoc/>
4555
/// </summary>
@@ -59,7 +69,12 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
5969
/// <inheritdoc/>
6070
/// </summary>
6171
/// <returns></returns>
62-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, nameof(TriggerPostData));
72+
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, new
73+
{
74+
Data,
75+
TriggerPostDataCallback = nameof(TriggerPostData),
76+
TriggerLoadedCallback = nameof(TriggerLoaded)
77+
});
6378

6479
/// <summary>
6580
/// 推送数据方法

0 commit comments

Comments
 (0)