努力的欣欣吖 2021-08-17 10:22 采纳率: 100%
浏览 46
已结题

怎么让后台给我的这个数据动态的运用到element ui的树形控件中?不确定有多少下级,我运用进去有问题,显示不出来

怎么让后台给我的这个数据动态的运用到element ui的树形控件中?(** 数据有很多层级,不确定层级,类似选择文件夹的功能**)
最好使用el-tree,我只能显示出一级,其他有问题
我把后端给我的数据贴出来,要树形显示name

{
    "code": 200,
    "message": "",
    "errorMsg": "",
    "total": 0,
    "data": [
        {
            "ofcId": 21,
            "parentId": 0,
            "companyId": 10,
            "name": "2级-你好1",
            "fullName": "2级-你好1",
            "parentPath": "0/",
            "isParent": true,
            "level": 0,
            "isPublic": false,
            "createTime": 1626682259000,
            "updateTime": null,
            "deleted": false,
            "tOssFileClassDTOList": [
                {
                    "ofcId": 26,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": true,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1626689959000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": [
                        {
                            "ofcId": 27,
                            "parentId": 26,
                            "companyId": 10,
                            "name": "4级-111",
                            "fullName": "2级-你好1/3级-123123/4级-111",
                            "parentPath": "0/21/26/",
                            "isParent": false,
                            "level": 2,
                            "isPublic": false,
                            "createTime": 1626690311000,
                            "updateTime": null,
                            "deleted": false,
                            "tOssFileClassDTOList": null,
                            "parent": false,
                            "public": false
                        }
                    ],
                    "parent": true,
                    "public": false
                },
                {
                    "ofcId": 28,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": false,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1627878410000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": null,
                    "parent": false,
                    "public": false
                },
                {
                    "ofcId": 29,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": false,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1627878597000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": null,
                    "parent": false,
                    "public": false
                },
                {
                    "ofcId": 30,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": false,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1627880112000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": null,
                    "parent": false,
                    "public": false
                },
                {
                    "ofcId": 31,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": false,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1627880316000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": null,
                    "parent": false,
                    "public": false
                },
                {
                    "ofcId": 32,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": false,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1627880860000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": null,
                    "parent": false,
                    "public": false
                },
                {
                    "ofcId": 33,
                    "parentId": 21,
                    "companyId": 10,
                    "name": "3级-123123",
                    "fullName": "2级-你好1/3级-123123",
                    "parentPath": "0/21/",
                    "isParent": false,
                    "level": 1,
                    "isPublic": false,
                    "createTime": 1627880952000,
                    "updateTime": null,
                    "deleted": false,
                    "tOssFileClassDTOList": null,
                    "parent": false,
                    "public": false
                }
            ],
            "parent": true,
            "public": false
        },
        {
            "ofcId": 22,
            "parentId": 0,
            "companyId": 10,
            "name": "2级-阿巴巴",
            "fullName": "2级-阿巴巴",
            "parentPath": "0/",
            "isParent": true,
            "level": 0,
            "isPublic": false,
            "createTime": 1626682268000,
            "updateTime": null,
            "deleted": false,
            "tOssFileClassDTOList": [],
            "parent": true,
            "public": false
        }
    ]
}

谢谢啦

  • 写回答

4条回答 默认 最新

  • gzczzzzzz 2021-08-17 10:30
    关注
    
    <el-tree :data="res.data" :props="{label:'name',children:'tOssFileClassDTOList'}"></el-tree>
    
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(3条)

报告相同问题?

问题事件

  • 系统已结题 8月25日
  • 已采纳回答 8月17日
  • 修改了问题 8月17日
  • 修改了问题 8月17日
  • 展开全部

悬赏问题

  • ¥15 CST仿真别人的模型结果仿真结果S参数完全不对
  • ¥15 请问在阿里云服务器中怎么利用数据库制作网站
  • ¥60 ESP32怎么烧录自启动程序
  • ¥50 html2canvas超出滚动条不显示
  • ¥15 java业务性能问题求解(sql,业务设计相关)
  • ¥15 52810 尾椎c三个a 写蓝牙地址
  • ¥15 elmos524.33 eeprom的读写问题
  • ¥15 用ADS设计一款的射频功率放大器
  • ¥15 怎么求交点连线的理论解?
  • ¥20 软件开发方法学习来了