Merge pull request #133 from hailaz/v2.0

fix: 修复数据树为空时,无法显示的问题
This commit is contained in:
孟帅 2024-08-22 22:01:05 +08:00 committed by GitHub
commit 194e86ea05
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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