1 2 3 4 5

el-tree 数据递归

记录:由于后端数据不能直接用于el-tree,在转换数据的时候树的层级不能确定于是采取递归解决

transformData(treeData) { let children = []; treeData.forEach((item, index) => { if (item.deepData && item.deepData.length > 0) { children.push({ name: item.name, skuId: item.id, num: item.num, children: this.transformData(item.deepData) }); } else { children.push({ name: item.name, skuId: item.id, num: item.num, }); } }); return children; }

 


__EOF__

本文作者橙汁先辈
本文链接https://www.cnblogs.com/kc-yukikaze/p/16476550.html
关于博主:评论和私信会在第一时间回复。或者直接私信我。
版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!
声援博主:如果您觉得文章对您有帮助,可以点击文章右下角推荐一下。您的鼓励是博主的最大动力!
posted @   $alute  阅读(458)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 物流快递公司核心技术能力-地址解析分单基础技术分享
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
· SQL Server 2025 AI相关能力初探
点击右上角即可分享
微信分享提示