!773 feat(#I2A033): TabItem add new method

* feat: Add new method AddTab for Tab
* feat: Add method for create new TabItem
This commit is contained in:
Argo 2020-12-19 00:11:09 +08:00
parent 842d74d06a
commit 1e32b7eda8
2 changed files with 24 additions and 0 deletions

View File

@ -257,6 +257,17 @@ namespace BootstrapBlazor.Components
return Task.CompletedTask;
}
/// <summary>
/// 添加 TabItem 方法
/// </summary>
/// <param name="parameters"></param>
public void AddTab(Dictionary<string, object> parameters)
{
var item = TabItem.Create(parameters);
_items.Add(item);
StateHasChanged();
}
/// <summary>
/// 移除 TabItem 方法
/// </summary>

View File

@ -8,6 +8,7 @@
// **********************************
using Microsoft.AspNetCore.Components;
using System.Collections.Generic;
namespace BootstrapBlazor.Components
{
@ -67,5 +68,17 @@ namespace BootstrapBlazor.Components
/// </summary>
/// <param name="active"></param>
public virtual void SetActive(bool active) => IsActive = active;
/// <summary>
/// 通过指定参数集合获取 TabItem 实例
/// </summary>
/// <param name="parameters"></param>
/// <returns></returns>
public static TabItem Create(Dictionary<string, object> parameters)
{
var item = new TabItem();
var _ = item.SetParametersAsync(ParameterView.FromDictionary(parameters));
return item;
}
}
}