美文网首页
React Native render()里面写js和迭代

React Native render()里面写js和迭代

作者: OK2018 | 来源:发表于2018-06-06 17:39 被阅读0次

{(this.state.helps!==null&&this.state.helps!=undefined&&this.state.helps.length>=1)?
                                  this.state.helps.map( (item,index,input) => {return (

                                    <View key={index} style={{
                                        flex:1,
                                        flexDirection: 'column',
                                        alignItems: 'center',
                                        backgroundColor: '#fff',
                                        paddingTop:10,
                                        paddingBottom:10,
                                        marginTop:10,
                                      }}>
                                      <View style={{flex:1,flexDirection:'row',}}>
                                        <View style={{flex:2,alignItems:'flex-end',}} >
                                            <Text style={{color:'gray', fontSize: 16}}>{item.type===1?'问需内容':'个案内容'}:  </Text>
                                        </View>
                                        <View style={{flex:3,alignItems:'flex-start', }}>
                                            <Text style={{color:'gray', paddingRight:10, fontSize: 16}}>{StringUtils.isEmpty(item.content)?'未知':item.content}</Text>
                                        </View>
                                        </View>




                                        

                                      </View>

                                    )} )



                                      :

                                      <View style={{
                                          flex:1,
                                          flexDirection: 'column',
                                          alignItems: 'center',
                                          backgroundColor: '#fff',
                                          alignItems:'center',
                                          paddingTop:10,
                                          paddingBottom:10,
                                          marginTop:10,
                                          marginBottom:10,
                                        }}>
                                            <Text style={{color:'gray', fontSize: 16}}>暂无</Text>
                                        </View>

                                        }

相关文章

网友评论

      本文标题:React Native render()里面写js和迭代

      本文链接:https://www.haomeiwen.com/subject/nhcisftx.html