Skip to content

Commit c069a65

Browse files
authored
doc(DemoBlock): add Height parameter (#4558)
1 parent d41b7f3 commit c069a65

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/BootstrapBlazor.Server/Components/Components/DemoBlock.razor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<p>@(new MarkupString(Introduction))</p>
77

88
<div class="card">
9-
<div class="card-body">
9+
<div class="card-body" style="@BodyStyleString">
1010
@ChildContent
1111
</div>
1212
@if (ShowCode)

src/BootstrapBlazor.Server/Components/Components/DemoBlock.razor.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
namespace BootstrapBlazor.Server.Components.Components;
77

88
/// <summary>
9-
///
9+
/// DemoBlock 组件
1010
/// </summary>
1111
public sealed partial class DemoBlock
1212
{
@@ -47,13 +47,23 @@ public sealed partial class DemoBlock
4747
[Parameter]
4848
public string? Name { get; set; }
4949

50+
/// <summary>
51+
/// 获得/设置 CardBody 高度 默认 null
52+
/// </summary>
53+
[Parameter]
54+
public string? Height { get; set; }
55+
5056
[CascadingParameter(Name = "RazorFileName")]
5157
private string? CodeFile { get; set; }
5258

5359
[Inject]
5460
[NotNull]
5561
private IStringLocalizer<DemoBlock>? Localizer { get; set; }
5662

63+
private string? BodyStyleString => CssBuilder.Default()
64+
.AddClass($"height: {Height};", !string.IsNullOrEmpty(Height))
65+
.Build();
66+
5767
/// <summary>
5868
/// <inheritdoc/>
5969
/// </summary>

0 commit comments

Comments
 (0)