v0.1.0-alpha
官网Home
components/virtuallist
布局与大数据Layout · 48 / 64

VirtualList

ui.widgets.VirtualList

只挂载可见窗口的大量等高数据。Mounts only the visible window of large uniform lists.

BEHAVIOR CONTRACT

item_count、item_height、overscan、复用和 scroll offset 决定稳定 O(visible) 成本。item_count, item_height, overscan, reuse and scroll offset give a stable O(visible) cost.

RECORDED INTERACTION

Harness 滚动列表,节点只覆盖可见区。The harness scrolls; nodes only cover the visible range.

examples/storybook/stories.zig:2944
pub fn buildVirtualList(scope: *ui.Scope, cx: *ui.Cx) anyerror!*ui.Node {
    const vl = try W.VirtualList(.{ .item_count = 1000, .item_height = 28, .width = 320, .height = 360 }).mount(scope, cx, vlRender);
    return vl.container;
}
在 GitHub 查看源码View source on GitHubexamples/storybook/stories.zig:2944

这是 Storybook 中该 story 的原样代码(zenit 5f9add5+wip 2026-09-30)。其中 W 即 ui.widgets,col / row / label 是 Storybook 内的布局小工具。The story's verbatim source from the Storybook (zenit 5f9add5+wip 2026-09-30). W is ui.widgets; col / row / label are small Storybook layout helpers.

zenit · 双授权Dual-licensed开源项目可按 GPL-3.0-only 免费使用;闭源或商业产品需要商业授权。Free for open-source projects under GPL-3.0-only; closed-source or commercial products need a commercial license.可联系作者:Contact the author: zongyi.xzy#gmail.com(# 换成 @) (replace # with @)zenit 5f9add5+wip 2026-09-30