javascript - 为网格指定多个反向条件

标签 javascript reactjs semantic-ui semantic-ui-react

在普通的语义 UI 中,我们可以这样做:

<div class="ui mobile reversed tablet reversed equal width grid container">

这将在移动设备和平板电脑分辨率上以相反的顺序显示列。 Example

我正在尝试使用 Semantic UI React 实现相同的行为,但我没有这样做。

这是我尝试过的:

<Grid reversed="computer tablet">
// or
<Grid reversed="computer,tablet">
// or
<Grid reversed="computer|tablet">
// or
<Grid reversed={["computer","tablet"]}>

所有结果都会出现类似的错误消息:

Warning: Failed prop type: Invalid prop reversed of value computer,tablet supplied to GridRow, expected one of ["computer","computer vertically","mobile","mobile vertically","tablet","tablet vertically"].

有没有办法实现这个,或者这是语义 UI React 中缺少的功能?


目前,我正在使用以下变通方法,它非常难看:

const content = [<Grid.Row key="row1">...</Grid.Row>, <Grid.Row key="rowN">...</Grid.Row>]
<Grid reversed="computer" only="computer">
  {content}
</Grid>
<Grid reversed="tablet" only="tablet">
  {content}
</Grid>
<Grid only="mobile">
  {content}
</Grid>

最佳答案

您可以使用网格的 className 属性:

<Grid className='table reversed computer reversed' />

该 Prop 是可用的,可以在这个 doc 中看到.

关于javascript - 为网格指定多个反向条件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46807674/

相关文章:

javascript - 在 html 网页加载时显示 JavaScript 表

javascript - React JS + Material UI 抛出 leftNav 未定义

javascript - 在 React JS 中处理 If 条件中的状态值

javascript - NodeJS - 记录到 Windows 事件日志?

javascript - 动态绑定(bind)事件处理程序的最有效方法

javascript - Node (express.js) next() 在流结束之前调用

reactjs - rtl 支持和配置与语义 ui react

android - 如何在 React Native 中使用 ListView 获得跑马灯效果?

javascript - 如何正确指定时区和日期对象格式,这样我就不会收到无效日期和不推荐使用的警告?

javascript - 语义 UI 下拉菜单不会动态选取菜单项