V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
TrackBack
V2EX  ›  React

React 列表虚拟化如何实现使用 CSS Grid 布局的同时支持拖动元素?

  •  
  •   TrackBack · 5 小时 48 分钟前 · 201 次点击

    开源的几乎所有虚拟化库都是要么支持单列列表,要么支持显式指定列数的网格(类似表格), 都没法处理 css grid 这种本质上是一维表格但是一行有多个元素的情况 魔改一番用上了,要么高度计算总是出问题,要么和拖拽不兼容

    这个场景应该是很常见的需求吧?什么文件浏览不是应该都会用到? 开发者工具看了下几家大厂的页面,居然都是 media query 按宽度直接设置 grid 布局列数。。。

    各位大佬有优雅一点的原生支持 css grid 的方案吗

    1 条回复    2026-01-15 16:36:22 +08:00
    shunia
        1
    shunia  
       8 分钟前
    问 AI:

    2. TanStack Virtual
    A headless virtualization utility that is highly flexible because it does not provide its own UI components. It allows you to build custom grid layouts, including responsive grids with aspect ratios.

    Grid Support: Excellent for complex or "sticky" table grids where you need full control over the DOM structure.
    Framework Agnostic: While used heavily in React, it can also work with other frameworks if needed.
    关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   Solana   ·   5673 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 22ms · UTC 08:44 · PVG 16:44 · LAX 00:44 · JFK 03:44
    ♥ Do have faith in what you're doing.