Skip to content

Commit 74d5ab6

Browse files
committed
feat: 增加 ChildContent 模板
1 parent c174373 commit 74d5ab6

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

src/BootstrapBlazor/Components/Button/DialButton.razor

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@
2929
<div @key="@item" class="dial-item" role="menuitem" @onclick="@(e => OnClickItem(item))">
3030
@if (ItemTemplate == null)
3131
{
32-
<i class="@item.Icon"></i>
32+
if(item.ChildContent != null)
33+
{
34+
@item.ChildContent
35+
}
36+
else
37+
{
38+
<i class="@item.Icon"></i>
39+
}
3340
}
3441
else
3542
{

src/BootstrapBlazor/Components/Button/DialButtonItem.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ public class DialButtonItem : ComponentBase, IDisposable
2424
[NotNull]
2525
public string? Value { get; set; }
2626

27+
/// <summary>
28+
/// 获得/设置 组件内容
29+
/// </summary>
30+
[Parameter]
31+
public RenderFragment? ChildContent { get; set; }
32+
2733
[CascadingParameter]
2834
private List<DialButtonItem>? Items { get; set; }
2935

src/BootstrapBlazor/wwwroot/scss/theme/bootstrapblazor.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ $bb-button-circle-height: 45px;
6060

6161
// Button DialogButton
6262
$bb-dial-list-zindex: 5;
63-
$bb-dial-item-padding: 0.25rem 1rem;
63+
$bb-dial-item-padding: 0;
6464
$bb-dial-item-hover-bg: #e9ecef;
6565
$bb-dial-item-margin: 6px;
6666
$bb-dial-item-width: 40px;

0 commit comments

Comments
 (0)