nodecms icon indicating copy to clipboard operation
nodecms copied to clipboard

递归获取子树方法需要优化

Open mkoplqq2006 opened this issue 8 years ago • 0 comments

nodecms/api/models/Admin/Purview.js

getsubTree函数 delete records[key]; 改为 data.splice(key, 1);

for (var i = rs.length - 1; i >= 0; i--) { rs[i].children = getsubTree(parent_id + 1, records); } 改为 for (var i = rs.length - 1; i >= 0; i--) { rs[i].children = getsubTree(rs[i].id, records); } 由于源码中导航不涉及到排序功能,所以没有发现这种累加方式有不妥之处,这样优化即可,不谢。

mkoplqq2006 avatar Sep 21 '16 02:09 mkoplqq2006