프로젝트
GitHub에서 보기
andrelmlins/svelte-infinite-scroll
소개
Infinite Scroll Component to Svelte
웹 및 앱 개발측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalSvelte Infinite Scroll
Infinite Scroll Component to Svelte.
Installation
npm i svelte-infinite-scroll
// or
yarn add svelte-infinite-scroll
Note: to use this library in Sapper applications, install as devDependency. Take a look at this link.
Demo link
Local demo:
git clone https://github.com/andrelmlins/svelte-infinite-scroll.git
cd svelte-infinite-scroll
npm install && npm run dev
Examples
An example of how to use the library:
<script>
import InfiniteScroll from "svelte-infinite-scroll";
import allCountries from "./countries.js";
let page = 0;
let size = 20;
let countries = [];
$: countries = [
...countries,
...allCountries.splice(size * page, size * (page + 1) - 1)
];
</script>
<style>
ul {
width: 400px;
max-height: 400px;
overflow-x: scroll;
}
</style>
<ul>
{#each countries as country}
<li>{country.name}</li>
{/each}
<InfiniteScroll threshold={100} on:loadMore={() => page++} />
</ul>
Another examples
Properties
Component props:
| Prop | Type | Default | Description |
|---|---|---|---|
threshold |
number | 0 | Threshold to call loadMore |
elementScroll |
node | - | Element to bind scroll |
window |
bool | false | Bind scroll in window |
hasMore |
bool | true | Tells you if there are more items to load |
horizontal |
bool | false | Changing orientation |
reverse |
bool | false | Revese scroll direction |
Events
| Event | Description |
|---|---|
loadMore |
Tells you if there are more items to load |
NPM statistics
Download stats for this NPM package.
License
Svelte Infinite Scroll is open source software licensed as MIT.
관련 프로젝트 살펴보기
불러오는 중…
