-
-
Notifications
You must be signed in to change notification settings - Fork 309
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
doc(DrawerService): add documentation for DrawerService (#4027)
* refactor: 移动 Icon 组件位置 * doc: 更新文档配置 * doc: 增加 DrawerService 文档 * doc: 增加抽屉服务文档 * doc: 更新文档状态
- Loading branch information
Showing
10 changed files
with
110 additions
and
70 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
src/BootstrapBlazor.Server/Components/Samples/BootstrapBlazorIcons.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
@page "/icon" | ||
@inject IStringLocalizer<BootstrapBlazorIcons> Localizer | ||
|
||
<h3>@Localizer["IconsTitle"]</h3> | ||
|
||
<h4>@Localizer["IconsDescription"]</h4> | ||
|
||
<HeadContent> | ||
<style> | ||
.bb-icon { | ||
--bb-icon-width: 24px; | ||
--bb-icon-color: var(--bs-body-color); | ||
} | ||
</style> | ||
</HeadContent> | ||
|
||
<DemoBlock Title="@Localizer["FATitle"]" Introduction="@Localizer["FAIntro"]" Name="Font"> | ||
<BootstrapBlazorIcon Name="fa-solid fa-home"></BootstrapBlazorIcon> | ||
</DemoBlock> | ||
|
||
<DemoBlock Title="@Localizer["SvgTitle"]" Introduction="@Localizer["SvgIntro"]" Name="Svg"> | ||
<BootstrapBlazorIcon Name="config" IsSvgSprites="true" Url="./_content/BootstrapBlazor.IconPark/icon-park.svg"></BootstrapBlazorIcon> | ||
</DemoBlock> | ||
|
||
<DemoBlock Title="@Localizer["ImageTitle"]" Introduction="@Localizer["ImageIntro"]" Name="Image"> | ||
<BootstrapBlazorIcon> | ||
<img src="./favicon.png" alt="img" /> | ||
</BootstrapBlazorIcon> | ||
</DemoBlock> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
54 changes: 54 additions & 0 deletions
54
src/BootstrapBlazor.Server/Components/Samples/DrawerServices.razor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
@page "/drawer-service" | ||
@layout MainLayout | ||
@inject IStringLocalizer<DrawerServices> Localizer | ||
|
||
<h3>抽屉弹窗服务 <code>DrawerService</code></h3> | ||
<h4>组件库内置了抽屉弹窗服务</h4> | ||
|
||
<p class="code-label">1. 服务注入</p> | ||
|
||
<Pre>[Inject] | ||
[NotNull] | ||
private DrawerService? DrawerService { get; set; }</Pre> | ||
|
||
<p class="code-label">2. 使用服务</p> | ||
<p>调用 <code>DrawerService</code> 实例方法 <code>Show</code> 即可</p> | ||
|
||
<Pre>DrawerService.Show(new DrawerOption() | ||
{ | ||
ChildContent = BootstrapDynamicComponent.Create<Count>().Render() | ||
})</Pre> | ||
|
||
<p class="code-label">3. 设计思路</p> | ||
|
||
<ul class="ul-demo"> | ||
<li>弹窗服务仅仅负责弹出弹窗,并且提供 <code>Close</code> 关窗功能</li> | ||
<li>显示内容通过 <code>DrawerOption</code> 类参数 <code>ChildContent</code> 自行指定</li> | ||
<li>其他更多参数可参见 <code>DrawerOption</code> 类定义 <a href="drawer" target="_blank">[传送门]</a></li> | ||
</ul> | ||
|
||
<p class="code-label">4. 常见问题</p> | ||
|
||
<div> | ||
<GroupBox Title="代码中如何关闭弹窗" class="mb-3"> | ||
<p>在使用弹窗的过程中基本都是需要根据自己的业务需求放置一些业务逻辑处理按钮的,比如放置 <b>关闭</b> <b>保存</b> <b>应用</b> 等等,这些按钮逻辑有些是需要处理业务逻辑结束后,根据业务逻辑处理结果决定是否关闭弹窗,代码关闭弹窗我们组件库内置了一下几种办法</p> | ||
|
||
<ul class="ul-demo"> | ||
<li>弹窗关闭按钮 <code>DialogCloseButton</code></li> | ||
<p>这个组件时专门为弹窗设计的按钮组件,此组件内置了关闭所在弹窗功能,无需任何代码</p> | ||
<Pre><DialogCloseButton></Pre> | ||
<p>业务逻辑可使用 <code>OnClick</code> 或者 <code>OnClickWithoutRender</code> 处理,结束后自动关闭弹窗</p> | ||
<li>关闭回调方法</li> | ||
<Pre class="mt-3">[CascadingParameter] | ||
private Func<Task>? OnCloseAsync { get; set; }</Pre> | ||
<p>弹窗内部任何组件中均可以通过此级联参数获得一个关闭弹窗的方法,可以根据自己的业务逻辑需求自行调用关闭弹窗</p> | ||
<p><b>注意:</b>级联参数定义可以随意不一定是 <code>OnCloseAsync</code> 也可以根据自己需要更改为 <code>CloseDrawerAsync</code></p> | ||
</ul> | ||
<ul class="ul-demo"> | ||
<li>关闭按钮 <code>DialogCloseButton</code></li> | ||
<p>点击后直接关窗,不进行业务逻辑处理</p> | ||
<li>保存按钮 <code>DialogSaveButton</code></li> | ||
<p>点击后触发 <b>Table</b> 组件内置的保存逻辑,此按钮实际为 <code>submit</code> 按钮,提交表单后触发表单验证逻辑,通过数据有效性验证后调用表格组件 <code>OnSaveAsync</code> 回调方法,控制权再次转移到开发者</p> | ||
</ul> | ||
</GroupBox> | ||
</div> |
7 changes: 7 additions & 0 deletions
7
src/BootstrapBlazor.Server/Components/Samples/DrawerServices.razor.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
::deep .legend { | ||
font-weight: bolder; | ||
} | ||
|
||
::deep .groupbox .ul-demo > li { | ||
font-weight: bolder; | ||
} |
26 changes: 0 additions & 26 deletions
26
src/BootstrapBlazor.Server/Components/Samples/Icons/BootstrapBlazorIcons.razor
This file was deleted.
Oops, something went wrong.
8 changes: 0 additions & 8 deletions
8
src/BootstrapBlazor.Server/Components/Samples/Icons/BootstrapBlazorIcons.razor.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.