el-tree 后端返回的树形结构重命名数据循环
<el-tree
:default-expand-all="true"
class="trees"
:data="cameraData"
:props="defaultProps"
@node-click="handleNodeClick"
:highlight-current="true"
>
</el-tree>
defaultProps: {
children: "children",
label: "label",
},
this.cameraData = res.datas.cameraList.map((ele) => {
ele.label = ele.floor;
ele.children = ele.cameraValue.map((v) => {
v.label = v.compartmentRoomName;
v.value = v.compartmentRoomName;
v.children = v.cameraDetail.map((o) => {
o.label = o.name;
o.status = o.deviceId;
o.loading = false;
o.isSelectEd = false;
o.timer = null;
return o;
});
return v;
});
return ele;
});
原文地址:https://blog.csdn.net/wwf1225/article/details/139176112
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!