【发布时间】:2019-09-23 12:03:25
【问题描述】:
我在网上找到的所有examples 都只展示了如何创建单级手风琴,如下所示:
-parent1
-child1
-parent2
-child2
我需要创建具有多个嵌套父级的动态手风琴,如下所示:
-parent
-subparent1
-subparent2
...
-subparentN
- child
我的数据采用这种格式:
// first object in response is always considered to be the PARENT,
last one is always CHILD, and those in between are SUBPARENTS
// number of SUBPARENTS is not constant
"parents": [
{
"id": "583", // TOP LEVEL PARENT
"label": "PARENT",
"description": "irrelevant description here, i only need to show label for parents"
},
{
"id": "593",
"label": "SUBPARENT1",
"description": "..."
},
{
"id": "594",
"label": "SUBPARENT2",
"description": "..."
},
{
"id": "604",
"label": "SUBPARENT3",
"description": "..."
},
{
"id": "605", // CHILD
"label": "CHILD LABEL",
"description": "FEW LINES OF DESCRIPTION I NEED TO DISPLAY"
}
]
【问题讨论】:
标签: javascript react-native dynamic accordion jsonresponse