【问题标题】:semantic-ui-react <Responsive> not working for <Table.Cell>semantic-ui-react <Responsive> 不适用于 <Table.Cell>
【发布时间】:2018-06-14 01:27:31
【问题描述】:

我正在使用语义 UI 反应来呈现数据表。我的要求是当页面在移动视图上时,我隐藏某些列。我尝试在Table.Cell 元素上使用className="mobile hidden",但这似乎根本不起作用。

然后我尝试使用下面的Responsive 组件,但出现错误。我在这里错过了什么吗?找不到遇到此问题的其他人...

  <Responsive as={Table.Cell} minWidth={Responsive.onlyMobile.minWidth}>
     {record.datapoint}
  </Responsive>

调整窗口大小时,我在控制台中收到此错误...

index.js:2177 Warning: Can only update a mounted or mounting component. This usually means you called setState, replaceState, or forceUpdate on an unmounted component. This is a no-op.

Please check the code for the Responsive component.

【问题讨论】:

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


    【解决方案1】:

    事实上,这是错误 :( 我创建了 PR 可以解决所描述的问题,请参阅 Semantic-Org/Semantic-UI-React#2421

    您提供的代码不会重现问题,提供的示例将永远不会出现该问题。但是,它存在 :) 核心问题是卸载 Responsive 组件时,它将由父级完成,setState() 将在未安装的组件上调用。 codesandbox 上的一个例子重现了问题。

    【讨论】:

    • 感谢您的跟进!
    猜你喜欢
    • 2017-06-01
    • 2018-12-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-09
    相关资源
    最近更新 更多