fix: 修复数据树为空时,无法显示的问题

This commit is contained in:
hailaz 2024-08-15 20:35:20 +08:00
parent 950637a976
commit cc13a16e90

View File

@ -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