Skip to content

Commit c095c99

Browse files
committed
feat(DockViewConfig): add FirstRender parameter
1 parent c440af1 commit c095c99

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

src/components/BootstrapBlazor.DockView/Components/DockViewConfig.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ namespace BootstrapBlazor.Components;
1212
/// </summary>
1313
class DockViewConfig
1414
{
15+
/// <summary>
16+
/// <para lang="zh">获得/设置 是否首次加载,默认为 false</para>
17+
/// <para lang="en">Gets or sets whether it is the first render. Default is false</para>
18+
/// </summary>
19+
public bool FirstRender { get; set; }
20+
1521
/// <summary>
1622
/// <para lang="zh">获得/设置 是否启用本地布局持久化,默认为 true</para>
1723
/// <para lang="en">Gets or sets whether local layout persistence is enabled. Default is true</para>

src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -203,9 +203,9 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
203203
/// <summary>
204204
/// <inheritdoc />
205205
/// </summary>
206-
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, GetOptions());
206+
protected override Task InvokeInitAsync() => InvokeVoidAsync("init", Id, Interop, GetOptions(true));
207207

208-
private DockViewConfig GetOptions() => new()
208+
private DockViewConfig GetOptions(bool firstRender = false) => new()
209209
{
210210
EnableLocalStorage = EnableLocalStorage ?? _options.EnableLocalStorage ?? false,
211211
LocalStorageKey = $"{GetPrefixKey()}-{Name}-{GetVersion()}",
@@ -224,7 +224,8 @@ protected override async Task OnAfterRenderAsync(bool firstRender)
224224
LockChangedCallback = nameof(LockChangedCallbackAsync),
225225
SplitterCallback = nameof(SplitterCallbackAsync),
226226
Contents = _components,
227-
LoadTabs = nameof(LoadTabs)
227+
LoadTabs = nameof(LoadTabs),
228+
FirstRender = firstRender
228229
};
229230

230231
private string GetVersion() => Version ?? _options.Version ?? "v1";

0 commit comments

Comments
 (0)