/// <summary>
 /// 获得 是否展开字符串
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected string GetExpandedString(TreeItem item) => item.IsExpanded ? "true" : "false";
 /// <summary>
 /// 获得 SubTree 样式
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected string?GetSubTreeClassString(TreeItem item) => CssBuilder.Default("collapse-item collapse")
 .AddClass("show", item.IsExpanded)
 .Build();
 /// <summary>
 /// 获得 TreeNode 样式
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected string?GetTreeItemClassString(TreeItem item) => CssBuilder.Default("tree-item")
 .AddClass("is-expanded", item.IsExpanded)
 .Build();
 /// <summary>
 /// 获得 SubTree 样式
 /// </summary>
 /// <param name="item"></param>
 /// <returns></returns>
 protected string?GetSubTreeLinkClassString(TreeItem item) => CssBuilder.Default("nav-link show collapse")
 .AddClass("collapsed", !item.IsExpanded)
 .Build();
Exemple #5
0
 /// <summary>
 /// 添加 Menutem 方法 由 MenuItem 方法加载时调用
 /// </summary>
 /// <param name="item">Menutem 实例</param>
 public void AddItem(TreeItem item)
 {
     item.Parent = this;
     _items.Add(item);
 }