Skip to content

Commit 0108bb0

Browse files
Lambert LeeArgoZhang
authored andcommitted
!3741 doc(#I69F1U): update empty demos
* update empty demos
1 parent 8c22a16 commit 0108bb0

7 files changed

Lines changed: 45 additions & 56 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@inject IStringLocalizer<EmptyImage> Localizer
2+
3+
<div>
4+
<Empty Image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg" Width="133" Text="@Localizer["ImageText"]" />
5+
</div>
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<div>
2+
<Empty />
3+
</div>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
@inject NavigationManager NavigationManager
2+
@inject IStringLocalizer<EmptyTemplate> Localizer
3+
4+
<div>
5+
<Empty Image="_content/BootstrapBlazor.Shared/images/empty.svg">
6+
<Template>
7+
<Button OnClick="@(()=>NavigationManager.NavigateTo("components"))">@Localizer["TemplateIButtonText"]</Button>
8+
</Template>
9+
</Empty>
10+
</div>

src/BootstrapBlazor.Shared/Locales/en.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4144,14 +4144,12 @@
41444144
"BootstrapBlazor.Shared.Samples.Empties": {
41454145
"Title": "Empty",
41464146
"SubTitle": "Sub Title PlaceHolder",
4147-
"BasicUsageTitle": "Basic usage",
4148-
"BasicUsageIntro": "Just add <code>Empty</code> tag",
4147+
"NormalTitle": "Basic usage",
4148+
"NormalIntro": "Just add <code>Empty</code> tag",
41494149
"ImageTitle": "Set the path to the empty state picture",
41504150
"ImageIntro": "Just set the <code>Image</code> property",
4151-
"ImageText": "No data at this time",
41524151
"TemplateTitle": "Customize the empty state template",
41534152
"TemplateIntro": "The inner set renders custom components <code>Template</code> labels",
4154-
"TemplateIButtonText": "Go back to the previous page",
41554153
"Image": "Customize the picture path",
41564154
"Text": "Custom description information",
41574155
"TextDefaultValue": "There is no description at this time",
@@ -4160,6 +4158,12 @@
41604158
"Template": "Custom templates",
41614159
"ChildContent": "ChildContent"
41624160
},
4161+
"BootstrapBlazor.Shared.Demos.Empty.EmptyImage": {
4162+
"ImageText": "No data at this time"
4163+
},
4164+
"BootstrapBlazor.Shared.Demos.Empty.EmptyTemplate": {
4165+
"TemplateIButtonText": "Go back to the previous page"
4166+
},
41634167
"BootstrapBlazor.Shared.Samples.GroupBoxs": {
41644168
"Title": "GroupBox",
41654169
"SubTitle": "Simulate WinForm's GroupBox components",

src/BootstrapBlazor.Shared/Locales/zh.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4151,14 +4151,12 @@
41514151
"BootstrapBlazor.Shared.Samples.Empties": {
41524152
"Title": "Empty 空状态",
41534153
"SubTitle": "空状态时的展示占位图",
4154-
"BasicUsageTitle": "基础用法",
4155-
"BasicUsageIntro": "添加 <code>Empty</code> 标签即可",
4154+
"NormalTitle": "基础用法",
4155+
"NormalIntro": "添加 <code>Empty</code> 标签即可",
41564156
"ImageTitle": "设置空状态图片路径",
41574157
"ImageIntro": "设置 <code>Image</code> 属性即可",
4158-
"ImageText": "暂无数据",
41594158
"TemplateTitle": "自定义空状态模板",
41604159
"TemplateIntro": "内套 <code>Template</code> 标签渲染自定义组件",
4161-
"TemplateIButtonText": "返回上一页",
41624160
"Image": "自定义图片路径",
41634161
"Text": "自定义描述信息",
41644162
"TextDefaultValue": "暂无描述",
@@ -4167,6 +4165,12 @@
41674165
"Template": "自定义模板",
41684166
"ChildContent": "子组件"
41694167
},
4168+
"BootstrapBlazor.Shared.Demos.Empty.EmptyImage": {
4169+
"ImageText": "暂无数据"
4170+
},
4171+
"BootstrapBlazor.Shared.Demos.Empty.EmptyTemplate": {
4172+
"TemplateIButtonText": "返回上一页"
4173+
},
41704174
"BootstrapBlazor.Shared.Samples.GroupBoxs": {
41714175
"Title": "GroupBox 集合组件",
41724176
"SubTitle": "模拟 WinForm 的 GroupBox 组件",
Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
@page "/empties"
22
@inject NavigationManager NavigationManager
3+
@inject IStringLocalizer<Empties> Localizer
34

4-
<h3>@Title</h3>
5-
<h4>@SubTitle</h4>
5+
<h3>@Localizer["Title"]</h3>
6+
<h4>@Localizer["SubTitle"]</h4>
67

7-
<DemoBlock Title="@Localizer["BasicUsageTitle"]" Introduction="@Localizer["BasicUsageIntro"]" Name="Normal">
8-
<Empty />
9-
</DemoBlock>
8+
<DemoBlock Title="@Localizer["NormalTitle"]" Introduction="@Localizer["NormalIntro"]" Name="Normal" Demo="typeof(Demos.Empty.EmptyNormal)" />
109

11-
<DemoBlock Title="@Localizer["ImageTitle"]" Introduction="@Localizer["ImageIntro"]" Name="Image">
12-
<Empty Image="https://gw.alipayobjects.com/zos/antfincdn/ZHrcdLPrvN/empty.svg" Width="133" Text="@Localizer["ImageText"]" />
13-
</DemoBlock>
10+
<DemoBlock Title="@Localizer["ImageTitle"]" Introduction="@Localizer["ImageIntro"]" Name="Image" Demo="typeof(Demos.Empty.EmptyImage)" />
1411

15-
<DemoBlock Title="@Localizer["TemplateTitle"]" Introduction="@Localizer["TemplateIntro"]" Name="Template">
16-
<Empty Image="_content/BootstrapBlazor.Shared/images/empty.svg">
17-
<Template>
18-
<Button OnClick="@(()=>NavigationManager.NavigateTo("components"))">@Localizer["TemplateIButtonText"]</Button>
19-
</Template>
20-
</Empty>
21-
</DemoBlock>
12+
<DemoBlock Title="@Localizer["TemplateTitle"]" Introduction="@Localizer["TemplateIntro"]" Name="Template" Demo="typeof(Demos.Empty.EmptyTemplate)" />
2213

2314
<AttributeTable Items="@GetAttributes()" />
2415

src/BootstrapBlazor.Shared/Samples/Empties.razor.cs

Lines changed: 5 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,18 @@
55
namespace BootstrapBlazor.Shared.Samples;
66

77
/// <summary>
8-
///
8+
/// Empties
99
/// </summary>
1010
public partial class Empties
1111
{
12-
13-
/// <summary>
14-
///
15-
/// </summary>
16-
[Parameter]
17-
public string? Title { get; set; }
18-
19-
/// <summary>
20-
///
21-
/// </summary>
22-
[Parameter]
23-
public string? SubTitle { get; set; }
24-
25-
/// <summary>
26-
///
27-
/// </summary>
28-
[Inject]
29-
[NotNull]
30-
private IStringLocalizer<Empties>? Localizer { get; set; }
31-
32-
/// <summary>
33-
///
34-
/// </summary>
35-
36-
protected override void OnInitialized()
37-
{
38-
base.OnInitialized();
39-
Title = Localizer[nameof(Title)];
40-
SubTitle = Localizer[nameof(SubTitle)];
41-
}
42-
4312
/// <summary>
4413
/// 获得属性方法
4514
/// </summary>
4615
/// <returns></returns>
47-
private IEnumerable<AttributeItem> GetAttributes() => new[]
16+
private IEnumerable<AttributeItem> GetAttributes()
4817
{
18+
return new[]
19+
{
4920
// TODO: 移动到数据库中
5021
new AttributeItem() {
5122
Name = "Image",
@@ -90,4 +61,5 @@ private IEnumerable<AttributeItem> GetAttributes() => new[]
9061
DefaultValue = " — "
9162
}
9263
};
64+
}
9365
}

0 commit comments

Comments
 (0)