【发布时间】:2021-08-13 01:55:50
【问题描述】:
我有这样的 JSON 文件
[{
"amenity": ["bar", "restaurant", "college", "library", "school", "university", "atm", "bank", "clinic", "hospital", "pharmacy", "nursing_home", "cinema", "embassy", "fire_station", "police", "post_office", "toilets", ""],
"Buildings": ["yes", "apartments", "bungalow", "hotel", "house", "residential", "commercial", "supermarket", "school", "religious", "hospital", "government", "college"],
"highway": ["motorway", "trunk", "primary", "secondary", "tertiary", "unclassified", "residential", "pedestrian", "footway", "path", "bus_stop"]
}]
我需要在 react 组件中显示这个 JSON 文件。我需要在第一个中显示两个选择选项我需要在第二个中选择 3 个键中的任何一个,例如设施、建筑物、高速公路我需要在第二个对象中显示数组的相应值
【问题讨论】:
-
你试过什么?包含相关的 React 组件类代码。
-
我尝试过使用 React 函数式组件
标签: javascript html json reactjs drop-down-menu