Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type INode ¶
type INode interface {
// GetTitle 获取显示名字
GetTitle() string
// GetId获取id
GetId() int
// GetFatherId 获取父id
GetFatherId() int
// GetData 获取附加数据
GetData() interface{}
// IsRoot 判断当前节点是否是顶层根节点
IsRoot() bool
}
ConvertToINodeArray 其他的结构体想要生成菜单树,直接实现这个接口
func FindRelationNode ¶
FindRelationNode 在 allTree 中查询 nodes 中节点的所有父节点 nodes 要查询父节点的子节点数组 allTree 所有节点数组
type Tree ¶
type Tree struct {
Title string `json:"title"` //节点名字
Data interface{} `json:"data"` //自定义对象
Leaf bool `json:"leaf"` //叶子节点
Selected bool `json:"checked"` //选中
PartialSelected bool `json:"partial_selected"` //部分选中
Children []Tree `json:"children"` //子节点
}
Tree 统一定义菜单树的数据结构,也可以自定义添加其他字段
func GenerateTree ¶
GenerateTree 自定义的结构体实现 INode 接口后调用此方法生成树结构 nodes 需要生成树的节点 selectedNode 生成树后选中的节点 menuTrees 生成成功后的树结构对象
Click to show internal directories.
Click to hide internal directories.