Skip to content

Commit d2d7145

Browse files
committed
feat: 增加弹窗内按钮图标参数
1 parent 759403a commit d2d7145

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

src/BootstrapBlazor/Components/Button/PopConfirmButtonContent.razor

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,17 @@
2727
<div class="popover-confirm-buttons">
2828
@if (ShowCloseButton)
2929
{
30-
<div class="@CloseButtonClass" @onclick="@OnCloseClick">
30+
<button class="@CloseButtonClass" @onclick="@OnCloseClick">
31+
<i class="@CloseButtonIcon"></i>
3132
<span>@CloseButtonText</span>
32-
</div>
33+
</button>
3334
}
3435
@if (ShowConfirmButton)
3536
{
36-
<div class="@ConfirmButtonClass" @onclick="@OnConfirmClick">
37+
<button class="@ConfirmButtonClass" @onclick="@OnConfirmClick">
38+
<i class="@ConfirmButtonIcon"></i>
3739
<span>@ConfirmButtonText</span>
38-
</div>
40+
</button>
3941
}
4042
</div>
4143
}

src/BootstrapBlazor/Components/Button/PopConfirmButtonContent.razor.cs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@ public partial class PopConfirmButtonContent
5959
[Parameter]
6060
public RenderFragment? ChildContent { get; set; }
6161

62+
/// <summary>
63+
/// 获得/设置 关闭按钮显示图标
64+
/// </summary>
65+
[Parameter]
66+
public string? CloseButtonIcon { get; set; }
67+
6268
/// <summary>
6369
/// 获得/设置 关闭按钮显示文字
6470
/// </summary>
@@ -71,6 +77,12 @@ public partial class PopConfirmButtonContent
7177
[Parameter]
7278
public Color CloseButtonColor { get; set; } = Color.Secondary;
7379

80+
/// <summary>
81+
/// 获得/设置 确认按钮显示图标
82+
/// </summary>
83+
[Parameter]
84+
public string? ConfirmButtonIcon { get; set; }
85+
7486
/// <summary>
7587
/// 获得/设置 确认按钮显示文字
7688
/// </summary>
@@ -87,7 +99,6 @@ public partial class PopConfirmButtonContent
8799
/// 获得/设置 确认框图标
88100
/// </summary>
89101
[Parameter]
90-
[NotNull]
91102
public string? Icon { get; set; }
92103

93104
/// <summary>
@@ -114,6 +125,8 @@ protected override void OnParametersSet()
114125
base.OnParametersSet();
115126

116127
Icon ??= IconTheme.GetIconByKey(ComponentIcons.PopConfirmButtonConfirmIcon);
128+
CloseButtonIcon ??= IconTheme.GetIconByKey(ComponentIcons.PopConfirmButtonContentCloseButtonIcon);
129+
ConfirmButtonIcon ??= IconTheme.GetIconByKey(ComponentIcons.PopConfirmButtonContentConfirmButtonIcon);
117130
}
118131

119132
/// <summary>

src/BootstrapBlazor/Enums/ComponentIcons.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -410,6 +410,16 @@ public enum ComponentIcons
410410
/// </summary>
411411
PopConfirmButtonConfirmIcon,
412412

413+
/// <summary>
414+
/// PopConfirmButton 组件弹窗中 CloseButtonIcon 图标
415+
/// </summary>
416+
PopConfirmButtonContentCloseButtonIcon,
417+
418+
/// <summary>
419+
/// PopConfirmButton 组件弹窗中 ConfirmButtonIcon 图标
420+
/// </summary>
421+
PopConfirmButtonContentConfirmButtonIcon,
422+
413423
/// <summary>
414424
/// Rate 组件 StarIcon 图标
415425
/// </summary>

0 commit comments

Comments
 (0)