文档目录
Mod 裁剪列表
mod 裁剪视口:子节点使用窗口坐标,组件按视口原点补偿并裁剪。
import { ModScissorList } from "./index";
export function ModScissorListDemo() {
return (
<div className="relative h-24 w-32">
<ModScissorList height={40} left={8} scroll={16} top={8} width={60}>
{[0, 1, 2].map(index => (
<div
className="absolute h-4 bg-mc-green"
key={index}
style={{ left: 8, top: 8 + index * 16, width: 40 }}
/>
))}
</ModScissorList>
</div>
);
}
安装
$pnpm add @tennantite/commonnpm 方式安装编译产物;需要改造源码请用上方的 CLI 拷贝安装。
源码
packages/mods-core/src/shared/mod-scissor-list/index.tsxnpm 包保留源码目录,可直接复制改造。