?
data () {
return {
data: [{
label: " 1",
children: [{
label: " 1-1",
children: [{
label: " 1-1-1"
}]
}]
}, {
label: " 2",
children: [{
label: " 2-1",
children: [{
label: " 2-1-1"
}]
}, {
label: " 2-2",
children: [{
label: " 2-2-1"
}]
}]
}, {
label: " 3",
children: [{
label: " 3-1",
children: [{
label: " 3-1-1"
}]
}, {
label: " 3-2",
children: [{
label: " 3-2-1"
}]
}]
}],
defaultProps: {
children: "children",
label: "label"
}
};
}
};
topic description
it is also said on the Internet: you have misunderstood, the things given by the background do not need you to loop, and you do not need you to define the content in this array. Let the backend basically return in this format. Let me show you the
I returned.{
"status": 1,
"message": "",
"data": [{
"id": 4,
"parent_id": 0,
"url": "content",
"name": "",
"icon": "el-icon-menu",
"sort": 100,
"created_at": "2018-07-05 12:06:27",
"updated_at": "2018-07-05 14:37:04",
"deleted_at": null,
"_child": [{
"id": 5,
"parent_id": 4,
"url": "articles",
"name": "",
"icon": null,
"sort": 100,
"created_at": "2018-07-05 12:07:29",
"updated_at": "2018-07-05 14:24:55",
"deleted_at": null,
"is_last": true
}, {
"id": 6,
"parent_id": 4,
"url": "category",
"name": "",
"icon": null,
"sort": 100,
"created_at": "2018-07-05 14:24:06",
"updated_at": "2018-07-05 14:25:46",
"deleted_at": null,
"is_last": true
}, {
"id": 7,
"parent_id": 4,
"url": "article_edit",
"name": "",
"icon": null,
"sort": 100,
"created_at": "2018-07-05 14:26:43",
"updated_at": "2018-07-05 14:26:43",
"deleted_at": null,
"is_last": true
}],
"is_last": false
}, {
"id": 8,
"parent_id": 0,
"url": "system",
"name": "",
"icon": "el-icon-menu",
"sort": 100,
"created_at": "2018-07-05 14:28:09",
"updated_at": "2018-07-05 14:37:34",
"deleted_at": null,
"_child": [{
"id": 10,
"parent_id": 8,
"url": "config",
"name": "",
"icon": null,
"sort": 99,
"created_at": "2018-07-05 17:02:22",
"updated_at": "2018-07-05 17:02:22",
"deleted_at": null,
"is_last": true
}, {
"id": 9,
"parent_id": 8,
"url": "menu",
"name": "",
"icon": null,
"sort": 100,
"created_at": "2018-07-05 14:28:24",
"updated_at": "2018-07-05 14:28:24",
"deleted_at": null,
"is_last": true
}],
"is_last": false
}]
}
sources of topics and their own ideas
how do I return the background data to this format, how to understand the background and foreground code, and how to write
related codes
/ / Please paste the code text below (do not replace the code with pictures)