!1897 feat(#I4BS60): add a method that get current item of tab

* refactor: 重命名 GetActiveTab 方法
* refactor: 重构 获取当前 tab 方法
* doc: 添加 tab 页面资源文件
* feat: Tab 组件添加获得当前 Tab 的方法
This commit is contained in:
Nine 2021-09-25 13:52:30 +00:00 committed by Argo
parent acee455500
commit 5095964297
4 changed files with 14 additions and 0 deletions

View File

@ -701,6 +701,7 @@
"Method6": "Close the current tab method",
"Method7": "Close other tab methods",
"Method8": "Close all tab methods",
"Method9": "Get current tab methods",
"BackAddTabText": "I am a new Tab with the name {0}",
"BackText1": "Counter",
"BackText2": "Weather forecast",

View File

@ -701,6 +701,7 @@
"Method6": "关闭当前标签页方法",
"Method7": "关闭其他标签页方法",
"Method8": "关闭所有标签页方法",
"Method9": "获得当前标签页方法",
"BackAddTabText": "我是新建的 Tab, 名称是 {0}",
"BackText1": "计数器",
"BackText2": "天气预报",

View File

@ -273,6 +273,12 @@ namespace BootstrapBlazor.Shared.Pages
Parameters = "",
ReturnValue = "Task"
},
new MethodItem() {
Name = nameof(Tab.GetActiveTab),
Description = Localizer["Method9"]!,
Parameters = "",
ReturnValue = "Tabitem"
},
};
}
}

View File

@ -606,6 +606,12 @@ namespace BootstrapBlazor.Components
}
}
/// <summary>
/// 获得当前活动 Tab
/// </summary>
/// <returns></returns>
public TabItem? GetActiveTab() => _items.FirstOrDefault(s => s.IsActive);
private void ActiveTabItem(TabItem item)
{
_items.ForEach(i => i.SetActive(false));