如果/ else

时间:2019-07-29 18:26:24

标签: react-native

我用listItem列出 如果“ count”不为0,我想显示徽章

list.map((l, i) => (
   <ListItem
   containerStyle={{ width: '100%', borderBottomWidth: 1, borderColor: '#eee'}}
   style={{ paddingLeft: 0 }}
   key={i}
   leftAvatar={{ source: { uri: l.avatar } }}
   title={l.subject}
   subtitle={l.username}
   badge={{ value: l.count, textStyle: { color: 'white' } , badgeStyle: { backgroundColor: '#333', padding:8 } }} }
   chevron
   />
))

它已经溶解

badge={l.count !== 0 ? { value: l.count, textStyle: { color: 'white' } , badgeStyle: { backgroundColor: '#333', padding:8 } } : null}

1 个答案:

答案 0 :(得分:0)

您可以这样做:

Table = ActiveSheet.ListObjects("janWeight").ListColumns("Column 1").Index