Skip to content

Commit 05dbbb9

Browse files
committed
doc: 增加文档注释
1 parent c7b9f35 commit 05dbbb9

File tree

4 files changed

+24
-2
lines changed

4 files changed

+24
-2
lines changed

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,20 @@
7272
ShowDownloadButton="@_showDownloadButton" ShowZoomButton="@_showZoomButton" OnChange="@OnCardUpload"></CardUpload>
7373
</DemoBlock>
7474

75+
<DemoBlock Title="@Localizer["UploadActionButtonTemplateTitle"]"
76+
Introduction="@Localizer["UploadActionButtonTemplateIntro"]"
77+
Name="ActionButtonTemplate">
78+
<CardUpload TValue="string" IsMultiple="false" ShowDownloadButton="true" DefaultFileList="@DefaultFormatFileList.Take(1).ToList()"
79+
OnChange="@OnCardUpload">
80+
<BeforeActionButtonTemplate>
81+
<Button Color="Color.Secondary" Icon="fa-solid fa-flag" OnClickWithoutRender="() => OnTest1Click(context)"></Button>
82+
</BeforeActionButtonTemplate>
83+
<ActionButtonTemplate>
84+
<Button Color="Color.Secondary" Icon="fa-solid fa-home" OnClickWithoutRender="() => OnTest2Click(context)"></Button>
85+
</ActionButtonTemplate>
86+
</CardUpload>
87+
</DemoBlock>
88+
7589
<DemoBlock Title="@Localizer["UploadFileIconTitle"]"
7690
Introduction="@Localizer["UploadFileIconIntro"]"
7791
Name="FileIcon">

src/BootstrapBlazor.Server/Components/Samples/UploadCards.razor.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ private async Task OnCardUpload(UploadFile file)
6262
}
6363
}
6464

65+
private Task OnTest1Click(UploadFile file) => ToastService.Information("Action Button", $"{file.GetFileName()}");
66+
67+
private Task OnTest2Click(UploadFile file) => ToastService.Information("Action Button", $"{file.GetFileName()}");
68+
6569
private async Task SaveToFile(UploadFile file)
6670
{
6771
// Server Side 使用

src/BootstrapBlazor.Server/Locales/en-US.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3336,7 +3336,9 @@
33363336
"UploadsFileError": "The file is larger than 5M. Please reselect the file to upload.",
33373337
"UploadsSuccess": "File saved successfully",
33383338
"UploadsSaveFileError": "File save failed",
3339-
"UploadsWasmError": "In wasm mode, please call the api to save"
3339+
"UploadsWasmError": "In wasm mode, please call the api to save",
3340+
"UploadActionButtonTemplateTitle": "Custom action button",
3341+
"UploadActionButtonTemplateIntro": "Customize the action buttons on the card by setting the `<code>ActionButtonTemplate</code>` parameter (appending it to the end of the default button), and customize the action buttons on the card by setting the `<code>BeforeActionButtonTemplate</code>` parameter (insert it before the default button)."
33403342
},
33413343
"BootstrapBlazor.Server.Components.Samples.UploadDrops": {
33423344
"UploadsTitle": "DropUpload",

src/BootstrapBlazor.Server/Locales/zh-CN.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3336,7 +3336,9 @@
33363336
"UploadsFileError": "文件大于 5M 请重新选择文件上传",
33373337
"UploadsSuccess": "文件保存成功",
33383338
"UploadsSaveFileError": "文件保存失败",
3339-
"UploadsWasmError": "wasm 模式请调用 api 进行保存"
3339+
"UploadsWasmError": "wasm 模式请调用 api 进行保存",
3340+
"UploadActionButtonTemplateTitle": "自定义操作按钮",
3341+
"UploadActionButtonTemplateIntro": "通过设置 <code>ActionButtonTemplate</code> 参数,来自定义卡片上的操作按钮(在默认按钮后面追加),通过设置 <code>BeforeActionButtonTemplate</code> 参数,来自定义卡片上的操作按钮(在默认按钮前面追加)"
33403342
},
33413343
"BootstrapBlazor.Server.Components.Samples.UploadDrops": {
33423344
"UploadsTitle": "DropUpload 拖拽上传组件",

0 commit comments

Comments
 (0)