mirror of
https://github.com/bufanyun/hotgo.git
synced 2025-01-23 02:40:23 +08:00
fix: 修复数据树为空时,无法显示的问题
This commit is contained in:
parent
950637a976
commit
cc13a16e90
@ -13,6 +13,9 @@ type Node interface {
|
||||
|
||||
// ListToTree 根据上下级关系将列表数据转为树状数据
|
||||
func ListToTree(pid int64, nodes []Node) (list []Node, err error) {
|
||||
if len(nodes) == 0 {
|
||||
return nodes, nil
|
||||
}
|
||||
for _, v := range nodes {
|
||||
if v.PID() == pid {
|
||||
item := v
|
||||
|
Loading…
Reference in New Issue
Block a user