簡體   English   中英

語義用戶界面反應 <Responsive> 不工作 <Table.Cell>

[英]semantic-ui-react <Responsive> not working for <Table.Cell>

我正在使用語義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.

實際上,這是bug :(我創建了PR,可以解決上述問題,請參見Semantic-Org / Semantic-UI-React#2421

您提供的代碼不會重現問題,提供的示例永遠不會發生該問題。 但是,它存在:)核心問題是當它由父級完成並且在未修改的組件上調用setState()時, Responsive組件的卸載。 codesandbox上的示例重現了問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM