1、数据源:
var module = [
{
"1": [
{
"name": "公告区",
"todayposts": "0",
"fid": "2"
},
{
"name": "产品动态",
"todayposts": "0",
"fid": "58"
},
{
"name": "点小融专区",
"todayposts": "0",
"fid": "72"
},
{
"name": "点融黑帮",
"todayposts": "0",
"fid": "73"
}
],
"59": [
{
"name": "版务管理",
"todayposts": "0",
"fid": "60"
},
{
"name": "投诉建议",
"todayposts": "0",
"fid": "70"
},
{
"name": "问题求助",
"todayposts": "0",
"fid": "42"
}
]
......
]
2、React多重循环
<select value={ state.form.fid } onChange={ this.setStateByKey.bind(this, 'fid') }>
<option value="0">选择版块</option>
{
Object.keys(modules).map((key) => (
modules[key].map((item) => (
<option key={item.fid} value={item.fid}>{item.name}</option>
))
))
}
</select>
有疑问或技术交流,扫描公众号一起讨论学习。
更多React在线学习访问:http://each.sinaapp.com/react/index.html


被折叠的 条评论
为什么被折叠?



