Does the vue-element-admin tree table accept json data display correctly?

is still developing, I find that I really know too little, and the data in the background is like this

.
{
    "code": 0,
    "message": "",
    "data": [
        {
            "id": 2,
            "name": "",
            "url": "",
            "list": [
                {
                    "id": 13,
                    "name": "",
                    "url": "/common/list_type"
                },
                {
                    "id": 14,
                    "name": "",
                    "url": "/common/list_order"
                }
            ]
        },
        {
            "id": 3,
            "name": "",
            "url": "",
            "list": [
                {
                    "id": 18,
                    "name": "",
                    "url": "/pay/wx/order"
                },
                {
                    "id": 19,
                    "name": "",
                    "url": "/pay/wx/notify"
                },
                {
                    "id": 20,
                    "name": "",
                    "url": "/pay/wx/verify"
                }
            ]
        },
        {
            "id": 4,
            "name": "",
            "url": "",
            "list": [
                {
                    "id": 21,
                    "name": "",
                    "url": "/common/list_member"
                },
                {
                    "id": 22,
                    "name": "",
                    "url": "/common/save_member"
                },
                {
                    "id": 23,
                    "name": "",
                    "url": "/common/get_member"
                },
                {
                    "id": 24,
                    "name": "",
                    "url": "/common/delete_member"
                }
            ]
        },
        {
            "id": 5,
            "name": "",
            "url": "",
            "list": [
                {
                    "id": 25,
                    "name": "",
                    "url": "/common/list_meeting"
                },
                {
                    "id": 26,
                    "name": "",
                    "url": "/common/save_meeting"
                },
                {
                    "id": 27,
                    "name": "",
                    "url": "/common/get_meeting"
                }
            ]
        }
    ],
    "success": true
}

uses the tree table of ele.me "s background management system, but if you want to embed the data, you will not grade it.
only shows the first level, while the second level does not show

.

clipboard.png
found many ways on the Internet and felt useless.

<tree-table :data="data" :eval-func="func" :eval-args="args" :expand-all="expandAll" border>
      <el-table-column label="" align="center">
        <template slot-scope="scope">
          <span style="color:sandybrown">{{ scope.row.name }}</span>
          <!-- <el-tag>{{ scope.row.timeLine+"ms" }}</el-tag> -->
        </template>
      </el-table-column>
      <el-table-column label="" width="500" align="center">
        <template slot-scope="scope">
          <el-button type="text" @click="message(scope.row)"></el-button>
        </template>
      </el-table-column>
    </tree-table>

this is the structure of the tree table

  data() {
    return {
      func: treeToArray,
      expandAll: false,
      data: {
        id: "",
        name: "",
        children: [
          {
            id: "",
            name: ""
          }
        ]
      },
      args: [null, null, "timeLine"]
    };
  },

this is the format of the initial data. Am I wrong in the initial format?
has also introduced its widgets, which doesn"t seem to be the problem? Ask the boss to take a look at it!

May.05,2022

there is a question. tree-table does not seem to be an official component provided by element.


on the same floor, tree-table is not an official component. It seems that your background data format is different from the agreement. In the background data, list is converted into children to see


has been solved. As above, this is indeed deducted and changed from the element-admin background management system, as long as children is changed to list!


blogger, I encountered data problems when I was using the iview framework. The data in my background is json data with parent id, not this nested array format. Treetable in ivew only accepts this kind of json data with children, but I find it troublesome to convert it manually, and I am a rookie. Is there any solution?

Menu