【问题标题】:React-virtualized: how to use minWidth only反应虚拟化:如何仅使用 minWidth
【发布时间】:2017-08-09 16:58:20
【问题描述】:

我有 <Column /> 的宽度 attr。如何使最后一列宽度等于所有可用宽度(我的意思是块中的所有其他可用空间)?尝试设置minWidth,但需要宽度...

如果我设置的宽度很大,我在小屏幕上的其他列会减少​​。

【问题讨论】:

    标签: reactjs react-virtualized


    【解决方案1】:

    查看Column docs。相关的有:

    flexGrow    Number  Flex grow style; defaults to 0
    flexShrink  Number  Flex shrink style; defaults to 1
    maxWidth    Number  Maximum width of column; this property will only be used if :flexGrow is greater than 0
    minWidth    Number  Minimum width of column
    width       Number  Flex basis (width) for this column; This value can grow or shrink based on flexGrow and flexShrink properties
    

    在这种情况下,我相信您只需将flexGrow={1} 添加到您的最后一列。 Table 使用弹性盒子布局。

    FWIW 这也是react-virtualized Table demo 的工作方式。你可以看到它的源代码here

    【讨论】:

    • 我没有看到 flexGrow,我的错。这正是我所需要的。
    猜你喜欢
    • 2018-01-23
    • 2019-01-20
    • 2021-05-25
    • 1970-01-01
    • 2018-07-27
    • 1970-01-01
    • 2019-06-24
    • 2021-09-03
    • 2018-02-10
    相关资源
    最近更新 更多