提交修改
This commit is contained in:
@@ -9,9 +9,8 @@ namespace NBF
|
||||
/// 为TabItemData列表添加"全部"选项卡
|
||||
/// </summary>
|
||||
/// <param name="tabItems">原始选项卡列表</param>
|
||||
/// <param name="addListTitle"></param>
|
||||
/// <returns>包含"全部"选项卡的新列表</returns>
|
||||
public static void AddAllTabItem(this List<TabItemData> tabItems, bool addListTitle = false)
|
||||
public static void AddAllTabItem(this List<TabItemData> tabItems)
|
||||
{
|
||||
//判断是否存在二级目录,有二级目录则只在二级目录有"全部"选项卡
|
||||
if (tabItems.Any(tabItem => tabItem.Children.Count > 0))
|
||||
@@ -26,7 +25,7 @@ namespace NBF
|
||||
Key = "All",
|
||||
Icon = "All",
|
||||
IsAll = true,
|
||||
Items = GetAllItemsFromTabs(tabItemData.Children, addListTitle)
|
||||
Items = GetAllItemsFromTabs(tabItemData.Children)
|
||||
};
|
||||
tabItemData.Children.Insert(0, allTab);
|
||||
}
|
||||
@@ -40,7 +39,7 @@ namespace NBF
|
||||
Key = "All",
|
||||
Icon = "All",
|
||||
IsAll = true,
|
||||
Items = GetAllItemsFromTabs(tabItems, addListTitle)
|
||||
Items = GetAllItemsFromTabs(tabItems)
|
||||
};
|
||||
tabItems.Insert(0, allTab);
|
||||
}
|
||||
@@ -49,16 +48,20 @@ namespace NBF
|
||||
/// <summary>
|
||||
/// 递归获取所有选项卡中的项目(去重)
|
||||
/// </summary>
|
||||
private static List<object> GetAllItemsFromTabs(List<TabItemData> tabs, bool addListTitle = false)
|
||||
private static List<object> GetAllItemsFromTabs(List<TabItemData> tabs)
|
||||
{
|
||||
var allItems = new List<object>();
|
||||
|
||||
foreach (var tab in tabs)
|
||||
{
|
||||
allItems.Add(new ClassifyListTitleData()
|
||||
{
|
||||
Title = tab.Key
|
||||
});
|
||||
// if (addListTitle)
|
||||
// {
|
||||
// allItems.Add(new ClassifyListTitleData()
|
||||
// {
|
||||
// Title = tab.Key
|
||||
// });
|
||||
// }
|
||||
|
||||
// 添加当前选项卡的项目
|
||||
if (tab.Items != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user