From 93474eaa067c8967a450cbbd3aeb54e129c5214d Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 16 Feb 2020 20:54:25 +0900 Subject: [PATCH] =?UTF-8?q?2=E5=9B=9E=E7=9B=AE=E4=BB=A5=E9=99=8D=E3=81=AE?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=81=BF=E3=81=AF30=E5=80=8B?= =?UTF-8?q?=E3=81=BE=E3=81=A7=E3=83=95=E3=82=A7=E3=83=83=E3=83=81=E3=81=99?= =?UTF-8?q?=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/client/scripts/paging.ts | 6 ++++-- 1 file 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;