【问题标题】:ANTD Select mode="multiple" is slow when trying to implement select/de-select all尝试实现全选/取消全选时,ANTD Select mode="multiple" 很慢
【发布时间】:2019-10-25 07:20:44
【问题描述】:

我有一个不超过 30 项的清单。但是,当我单击全选然后取消选择或取消选择时,只有一个项目页面会冻结一段时间,然后再次恢复正常并更新选中或未选中的值。我不明白发生了什么。 这是 antd select 本身的问题,或者是因为切换选择/取消选择导致此延迟可能是因为整个列表非常频繁地重新渲染。 另外,在控制台中,我得到了类似的东西,

[Violation] 'setTimeout' handler took 109ms
[Violation] 'click' handler took 206ms
[Violation] Forced reflow while executing JavaScript took 72ms
[Violation] 'click' handler took 204ms
[Violation] 'click' handler took 390ms
[Violation] Forced reflow while executing JavaScript took 180ms
[Violation] 'animationend' handler took 13282ms
[Violation] 'animationend' handler took 13341ms
[Violation] Forced reflow while executing JavaScript took 12864ms
[Violation] 'click' handler took 171ms

ANTD 选择 - https://ant.design/components/select/

提前致谢。

【问题讨论】:

  • 可以在你使用antd select的地方加上代码吗?

标签: reactjs select drop-down-menu antd react-select


【解决方案1】:

不幸的是,这是 AntD 组件本身中的 known issue,目前还没有即将推出的解决方案。

除了维护 AntD 的一个分支并尝试自己优化重新渲染之外,唯一真正的解决方案是使用不同的库来管理数据。我建议您查看ag-gridreact-virtualizedreact-base-table,当然还有其他的。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-19
    • 1970-01-01
    • 2018-11-24
    • 2010-12-02
    相关资源
    最近更新 更多