我正在为 ux 使用 Grommet React 库。我正在做一个电话布局项目。
我有一个来自 redux 状态的道具,它代表一个元素数组。初始状态为空数组,服务器返回后,props 为
[{ country: 'England' }, { country: 'Germany' }, { country: 'Spain' }, { country: 'Zimbawe' }]
我想要的是一个列布局,每行正好有两列,每列占可用空间的 50%。
为此,我以这种方式使用了 Column 组件
<Columns responsive={false}>
{this.props.countries.map(this.renderCountries)}
</Columns>
最后是 renderCountries 方法
renderCountries (country) {
return <Box key={country.country}>{country.country}</Box>
}
但是使用此代码,系统将仅逐行呈现一个元素。如何逐行获取两列?
提前致谢