diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-16 20:54:25 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-16 20:54:25 +0900 |
| commit | 93474eaa067c8967a450cbbd3aeb54e129c5214d (patch) | |
| tree | 4c2de1d7bcc0df9761aa9d4c134dc6229916dd8b /src/client/scripts/paging.ts | |
| parent | Clean up (diff) | |
| download | sharkey-93474eaa067c8967a450cbbd3aeb54e129c5214d.tar.gz sharkey-93474eaa067c8967a450cbbd3aeb54e129c5214d.tar.bz2 sharkey-93474eaa067c8967a450cbbd3aeb54e129c5214d.zip | |
2回目以降の読み込みは30個までフェッチするように
Diffstat (limited to 'src/client/scripts/paging.ts')
| -rw-r--r-- | src/client/scripts/paging.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/client/scripts/paging.ts b/src/client/scripts/paging.ts index 5a03f5b4ee..f002c9f555 100644 --- a/src/client/scripts/paging.ts +++ b/src/client/scripts/paging.ts @@ -28,6 +28,8 @@ function onScrollTop(el, cb) { container.addEventListener('scroll', onScroll, { passive: true }); } +const SECOND_FETCH_LIMIT = 30; + export default (opts) => ({ data() { return { @@ -118,7 +120,7 @@ export default (opts) => ({ if (params && params.then) params = await params; const endpoint = typeof this.pagination.endpoint === 'function' ? this.pagination.endpoint() : this.pagination.endpoint; await this.$root.api(endpoint, { - limit: (this.pagination.limit || 10) + 1, + limit: SECOND_FETCH_LIMIT + 1, ...(this.pagination.offsetMode ? { offset: this.offset, } : { @@ -126,7 +128,7 @@ export default (opts) => ({ }), ...params }).then(x => { - if (x.length === (this.pagination.limit || 10) + 1) { + if (x.length === SECOND_FETCH_LIMIT + 1) { x.pop(); this.items = this.items.concat(x); this.more = true; |