for (const i in data) { if (!data[i].children || data[i].children.length == 0) { data[i].pid = "" data[i].sort = i } }
以上代码如何转为.map的写法呢
data.map((item, i) => { if (!item.children || item.children.length == 0) { item.pid = "" item.sort = i } })
1.4m articles
1.4m replys
5 comments
57.0k users