有如下结构
that.state.list.map(function(item,index){
return (
<li>{点我查看详情}
{this.state.show?
<DetailComponent data={this.state.date}/>
:null
}
</li> (index 序号)
)
})
大概是这样一个结构就是为每次点击li时请求数据 展示对应下标的li里的DetailComponent 详情 当我同时show多个时为啥所有的li的详情数据都会被变成我最后一次打开的详情数据 DetailComponent 里也是循环渲染dom结构的
相关分类