!3527 doc(#I60WL6): update sample code for RibbonTab component

* doc: 增加 FloatChanged 示例
* doc: 更新示例移除不使用的样式
* doc: 更改 OnHeaderClickAsync 为 OnMenuClickAsync
This commit is contained in:
Argo 2022-11-13 15:05:28 +00:00
parent acf3a5de01
commit db74615b9d
3 changed files with 14 additions and 9 deletions

View File

@ -11,11 +11,11 @@
<DemoBlock Title="@Localizer["P4"]" Introduction="@Localizer["P5"]" Name="Float">
<div class="ribbon-demo">
<RibbonTab Items="@Items" ShowFloatButton="true" />
<div class="ribbon-demo-body">
<RibbonTab Items="@Items" ShowFloatButton="true" OnFloatChanged="OnFloatChanged">
@Localizer["P6"]
</div>
</RibbonTab>
</div>
<BlockLogger @ref="Logger" />
</DemoBlock>
<DemoBlock Title="@Localizer["P7"]" Introduction="@Localizer["P8"]" Name="RightButtonsTemplate">
@ -30,7 +30,7 @@
</DemoBlock>
<DemoBlock Title="@Localizer["HeaderClickTitle"]" Introduction="@Localizer["HeaderClickIntro"]" Name="HeaderClick">
<RibbonTab Items="@Items" OnHeaderClickAsync="@OnHeaderClickAsync">
<RibbonTab Items="@Items" OnMenuClickAsync="@OnMenuClickAsync">
<div class="@FileClassString">@Localizer["ItemsText1"]</div>
<div class="@EditClassString">@Localizer["ItemsText2"]</div>
</RibbonTab>

View File

@ -60,13 +60,22 @@ public partial class RibbonTabs
.AddClass("show", ActiveTabText == Localizer["ItemsText2"])
.Build();
private Task OnHeaderClickAsync(string text, string url)
private Task OnMenuClickAsync(string text, string url)
{
ActiveTabText = text;
StateHasChanged();
return Task.CompletedTask;
}
[NotNull]
private BlockLogger? Logger { get; set; }
private Task OnFloatChanged(bool @float)
{
Logger.Log($"Float: {@float}");
return Task.CompletedTask;
}
private IEnumerable<AttributeItem> GetAttributes() => new AttributeItem[]
{
new AttributeItem()

View File

@ -1,7 +1,3 @@
.ribbon-demo {
height: 196px;
}
.ribbon-demo-body {
padding: 1rem;
}