怎么让后台给我的这个数据动态的运用到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
        }
    ]
}

谢谢啦


<el-tree :data="res.data" :props="{label:'name',children:'tOssFileClassDTOList'}"></el-tree>

img

Element Plus - The world's most popular Vue 3 UI framework Element Plus, a Vue 3 based component library for developers, designers and product managers https://element-plus.gitee.io/#/zh-CN/component/tree

下次直接看官网,上手一下

img