Skip to content

Commit a719fcf

Browse files
committed
doc: 增加样式设置示例
1 parent 7ffb16c commit a719fcf

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
</TableColumns>
2020
</Table>
2121
</section>
22-
<ExportPdfButton ElementId="table-9527-01" IsAsync="true" OnBeforeExport="OnBeforeExport" OnAfterDownload="OnAfterDownload" AutoDownload="true"></ExportPdfButton>
22+
<ExportPdfButton ElementId="table-9527-01" IsAsync="true" OnBeforeExport="OnBeforeExport" OnAfterDownload="OnAfterDownload" AutoDownload="true" StyleTags="_styleTags"></ExportPdfButton>
2323
</DemoBlock>
2424

2525
<DemoBlock Title="@Localizer["SelectorTitle"]" Introduction="@Localizer["SelectorIntro"]" Name="Selector">
@@ -41,7 +41,7 @@
4141
</div>
4242
</GroupBox>
4343
</section>
44-
<ExportPdfButton Selector=".table-9527-02" IsAsync="true" OnBeforeExport="OnBeforeExport" OnAfterDownload="OnAfterDownload" AutoDownload="true" FileName="@PdfFileName"></ExportPdfButton>
44+
<ExportPdfButton Selector=".table-9527-02" IsAsync="true" OnBeforeExport="OnBeforeExport" OnAfterDownload="OnAfterDownload" AutoDownload="true" FileName="@PdfFileName" StyleTags="_styleTags"></ExportPdfButton>
4545
</DemoBlock>
4646

4747
<AttributeTable Items="@GetAttributes()" />

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,17 @@ public partial class ExportPdfButtons
3232
[NotNull]
3333
private ToastService? ToastService { get; set; }
3434

35+
[Inject, NotNull]
36+
private NavigationManager? NavigationManager { get; set; }
37+
3538
private Task OnBeforeExport() => ToastService.Information(Localizer["ToastTitle"], Localizer["ToastContent"]);
3639

3740
private static string PdfFileName => $"Pdf-{DateTime.Now:HHmmss}.pdf";
3841

3942
private Task OnAfterDownload(string fileName) => ToastService.Success(Localizer["ToastDownloadTitle"], Localizer["ToastDownloadContent", fileName]);
4043

44+
private List<string> _styleTags = [];
45+
4146
/// <summary>
4247
/// <inheritdoc/>
4348
/// </summary>
@@ -46,6 +51,11 @@ protected override void OnInitialized()
4651
Items = Foo.GenerateFoo(FooLocalizer);
4752
Hobbies = Foo.GenerateHobbies(FooLocalizer);
4853
Model = Foo.Generate(FooLocalizer);
54+
55+
_styleTags.AddRange([
56+
$"{NavigationManager.BaseUri}_content/BootstrapBlazor.FontAwesome/css/font-awesome.min.css",
57+
$"{NavigationManager.BaseUri}_content/BootstrapBlazor/css/bootstrap.blazor.bundle.min.css"
58+
]);
4959
}
5060

5161
private AttributeItem[] GetAttributes() =>

0 commit comments

Comments
 (0)