Skip to content

Commit 136841b

Browse files
committed
refactor: 重构代码
1 parent a7f3865 commit 136841b

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

src/BootstrapBlazor.Server/Components/Samples/DockViews2/BaseDockView.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,6 @@ public abstract class BaseDockView : ComponentBase
3939
/// </summary>
4040
protected DataTableDynamicContext? DataTableDynamicContext { get; set; }
4141

42-
/// <summary>
43-
/// Gets or sets the theme
44-
/// </summary>
45-
protected DockViewTheme Theme { get; set; } = DockViewTheme.Light;
46-
4742
/// <summary>
4843
/// 获得 <see cref="DynamicObjectContext"/> 实例方法
4944
/// </summary>

src/BootstrapBlazor.Server/Components/Samples/DockViews2/DockViewLayout.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<Button OnClickWithoutRender="Reset" Text="复位"></Button>
1313
</GroupBox>
1414

15-
<DockViewV2 @ref="DockView" Name="DockViewLayout" LayoutConfig="@LayoutConfig" class="dock-layout-demo">
15+
<DockViewV2 @ref="@_dockView" Name="DockViewLayout" LayoutConfig="@_layoutConfig" class="dock-layout-demo">
1616
<DockViewContent Type="DockViewContentType.Column">
1717
<DockViewComponent Key="tab1" Title="标签一">
1818
<Table TItem="DynamicObject" DynamicContext="DataTableDynamicContext"

src/BootstrapBlazor.Server/Components/Samples/DockViews2/DockViewLayout.razor.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,26 @@ public partial class DockViewLayout
1515
private IStringLocalizer<DockViewLayout>? Localizer { get; set; }
1616

1717
[NotNull]
18-
private DockViewV2? DockView { get; set; }
18+
private DockViewV2? _dockView = null;
1919

20-
private Task Reset() => DockView.Reset(LayoutConfig);
20+
private Task Reset() => _dockView.Reset(_layoutConfig);
2121

2222
private void OnToggleLayout1()
2323
{
24-
LayoutConfig = LayoutConfig1;
24+
_layoutConfig = LayoutConfig1;
2525
}
2626

2727
private void OnToggleLayout2()
2828
{
29-
LayoutConfig = LayoutConfig2;
29+
_layoutConfig = LayoutConfig2;
3030
}
3131

3232
private void OnToggleLayout3()
3333
{
34-
LayoutConfig = LayoutConfig3;
34+
_layoutConfig = LayoutConfig3;
3535
}
3636

37-
private string LayoutConfig = LayoutConfig1;
37+
private string _layoutConfig = LayoutConfig1;
3838

3939
const string LayoutConfig1 = """{"grid":{"root":{"type":"branch","data":[{"type":"branch","data":[{"type":"leaf","data":{"views":["bb_5893789"],"activeView":"bb_5893789","id":"0"},"size":364},{"type":"leaf","data":{"views":["bb_11251481"],"activeView":"bb_11251481","id":"1"},"size":364},{"type":"leaf","data":{"views":["bb_39754773"],"activeView":"bb_39754773","id":"2"},"size":364}],"size":601}],"size":1092},"width":1092,"height":601,"orientation":"VERTICAL"},"panels":{"bb_5893789":{"id":"bb_5893789","contentComponent":"component","tabComponent":"component","params":{"componentName":"component","title":"标签一","titleWidth":null,"titleClass":null,"class":null,"visible":true,"showClose":true,"width":null,"height":null,"key":null,"isLock":false,"type":"component","id":"bb_5893789","additionalAttributes":null},"title":"标签一"},"bb_11251481":{"id":"bb_11251481","contentComponent":"component","tabComponent":"component","params":{"componentName":"component","title":"标签二","titleWidth":null,"titleClass":null,"class":null,"visible":true,"showClose":true,"width":null,"height":null,"key":null,"isLock":false,"type":"component","id":"bb_11251481","additionalAttributes":null},"title":"标签二"},"bb_39754773":{"id":"bb_39754773","contentComponent":"component","tabComponent":"component","params":{"componentName":"component","title":"标签三","titleWidth":null,"titleClass":null,"class":null,"visible":true,"showClose":true,"width":null,"height":null,"key":null,"isLock":false,"type":"component","id":"bb_39754773","additionalAttributes":null},"title":"标签三"}},"activeGroup":"1"}""";
4040

src/BootstrapBlazor.Server/Components/Samples/DockViews2/DockViewNest.razor

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<h4>@((MarkupString)Localizer["DockViewNestIntro"].Value)</h4>
77

8-
<Select @bind-Value="@Theme"></Select>
8+
<Select @bind-Value="@_theme"></Select>
99

1010
<DockViewV2 Name="DockViewNest" Theme="_theme" class="dockview-demo">
1111
<DockViewContent Type="DockViewContentType.Row">
@@ -40,7 +40,7 @@
4040
</Table>
4141
</DockViewComponent>
4242
<DockViewComponent Key="tab3" Title="嵌套布局" ShowHeader="false">
43-
<DockViewV2 Name="DockViewInnerNest" Theme="Theme">
43+
<DockViewV2 Name="DockViewInnerNest" Theme="_theme">
4444
<DockViewContent Type="DockViewContentType.Column">
4545
<DockViewComponent Key="tab31" Title="内嵌标签一">
4646
<Table TItem="TreeFoo" IsBordered="true" IsStriped="true"

0 commit comments

Comments
 (0)