1
This commit is contained in:
@@ -73,15 +73,20 @@ namespace BITKit.UX
|
||||
{
|
||||
_externalTabBar.OnTabChanged -= EntryTab;
|
||||
}
|
||||
if (panel?.visualTree != null)
|
||||
if (parent is not null)
|
||||
{
|
||||
_externalTabBar = panel.visualTree.Q<TabBar>(value);
|
||||
_externalTabBar = parent.Q<TabBar>(value);
|
||||
if (_externalTabBar is not null)
|
||||
{
|
||||
_externalTabBar.OnTabChanged += EntryTab;
|
||||
}
|
||||
}
|
||||
viewDataKey=_externalTabBar is null ? $"找到了:{value}" :$"未找到:{value}";
|
||||
}
|
||||
viewDataKey=_externalTabBar is null ? "找到了TabBar" :"未找到Tab";
|
||||
else
|
||||
{
|
||||
viewDataKey = $"{value} is null";
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
private readonly VisualElement _container;
|
||||
@@ -104,12 +109,24 @@ namespace BITKit.UX
|
||||
}
|
||||
public void EntryTab(int index)
|
||||
{
|
||||
if(index == -1)return;
|
||||
var isCatched = false;
|
||||
foreach (var x in _container.Children())
|
||||
{
|
||||
x.SetActive(false);
|
||||
}
|
||||
if(_container.Children().TryGetElementAt(index,out var element))
|
||||
|
||||
if (_container.Children().TryGetElementAt(index, out var element))
|
||||
{
|
||||
isCatched = true;
|
||||
element.SetActive(true);
|
||||
}
|
||||
|
||||
if (index is -1 && isCatched is false && this.childCount>0)
|
||||
{
|
||||
this.Children().First().SetActive(true);
|
||||
}
|
||||
|
||||
OnTabChanged?.Invoke(index);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user