js嵌套数组,怎么根据select等于true取出 “广州市荔湾区沙面街道翠洲社区” 和 “广州市荔湾区岭南街道扬仁西社区”这样的数据

来源:4-1 React项目中如何使用CSS样式修饰

慕后端5472875

2020-06-11 16:49

[{

            "regionName": "广州市", 

            "shortName": "广州", 

            "select": true, 

            "open": false,

            "levelCode": "city",

            "regionCode": "440100000000", 

            "regionList": [{ 

                "levelCode": "area", 

                "regionCode": "440103000000", 

                "regionList": [{ 

                    "levelCode": "town", 

                    "regionCode": "440103001000", 

                    "regionList": [{ 

                        "levelCode": "village", 

                        "regionCode": "440103001001", 

                        "regionList": [], 

                        "regionName": "翠洲社区", 

                        "shortName": "翠洲社区", 

                        "select": true, 

                        "open": false 

                    }], 

                    "regionName": "沙面街道", 

                    "shortName": "沙面街道", 

                    "select": true, 

                    "open": false 

                },{ 

                    "levelCode": "town", 

                    "regionCode": "440103002000", 

                    "regionList": [{ 

                        "levelCode": "village", 

                        "regionCode": "440103002021", 

                        "regionList": [], 

                        "regionName": "扬仁西社区", 

                        "shortName": "扬仁西社区", 

                        "select": true, 

                        "open": false 

                    }], 

                    "regionName": "岭南街道", 

                    "shortName": "岭南街道", 

                    "select": true, 

                    "open": false 

                }],

                "regionName": "荔湾区", 

                "shortName": "荔湾区", 

                "select": true, 

                "open": false 

            }]

        }]


写回答 关注

1回答

  • 想念_薇笑
    2020-10-30 17:05:59

    用for循环搭配递归

React16.4 快速上手

结合实例带你快速入门React16基础语法,并完成Todolist功能开发。

40002 学习 · 134 问题

查看课程

相似问题