1、使用for(let item of items){}
render(){ var itemList = [] for(let item of items){ itemList.push(<Item item={item}/>) } return( {itemList} ) }
2、使用map
render(){ return( {items.map((item) =>{ return( <Item item={item}/> ) } ) }
1、使用for(let item of items){}
render(){ var itemList = [] for(let item of items){ itemList.push(<Item item={item}/>) } return( {itemList} ) }
2、使用map
render(){ return( {items.map((item) =>{ return( <Item item={item}/> ) } ) }
转载于:https://www.cnblogs.com/zoeeying/p/10891950.html