
@egjs/反应-无限网格
根据网格类型可以无限排列项目的反应组件
* 安装
npm install --save @egjs/react-infinitegrid
QQ 快速启动
import * as React from "react";
import { MasonryInfiniteGrid } from "@egjs/react-infinitegrid";
function getItems(nextGroupKey: number, count: number) {
const nextItems = [];
const nextKey = nextGroupKey * count;
for (let i = 0; i < count; ++i) {
nextItems.push({ groupKey: nextGroupKey, key: nextKey + i });
}
return nextItems;
}
const Item = ({ num }: any) => <div className="item">...</div>;
export default function App() {
const [items, setItems] = React.useState(() => getItems(0, 10));
return <MasonryInfiniteGrid
className="container"
gap={5}
onRequestAppend={(e) => {
const nextGroupKey = (+e.groupKey! || 0) + 1;
setItems([
...items,
...getItems(nextGroupKey, 10),
]);
}}
>
{items.map((item) => <Item data-grid-groupkey={item.groupKey} key={item.key} num={item.key} />)}
</MasonryInfiniteGrid>;
}
捐款
见 捐款额。 。 。 .
* 反馈
请存档 问题 标签为“反应”.
许可证
egjs- 无限网格在 麻省理工学院许可证。 。 。 .
Copyright (c) 2015-present NAVER Corp.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
