mirror of
https://activitypub.software/TransFem-org/Sharkey.git
synced 2024-12-14 10:05:46 +01:00
2回目以降の読み込みは30個までフェッチするように
This commit is contained in:
parent
420eeb4d68
commit
93474eaa06
1 changed files with 4 additions and 2 deletions
|
@ -28,6 +28,8 @@ function onScrollTop(el, cb) {
|
||||||
container.addEventListener('scroll', onScroll, { passive: true });
|
container.addEventListener('scroll', onScroll, { passive: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SECOND_FETCH_LIMIT = 30;
|
||||||
|
|
||||||
export default (opts) => ({
|
export default (opts) => ({
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
@ -118,7 +120,7 @@ export default (opts) => ({
|
||||||
if (params && params.then) params = await params;
|
if (params && params.then) params = await params;
|
||||||
const endpoint = typeof this.pagination.endpoint === 'function' ? this.pagination.endpoint() : this.pagination.endpoint;
|
const endpoint = typeof this.pagination.endpoint === 'function' ? this.pagination.endpoint() : this.pagination.endpoint;
|
||||||
await this.$root.api(endpoint, {
|
await this.$root.api(endpoint, {
|
||||||
limit: (this.pagination.limit || 10) + 1,
|
limit: SECOND_FETCH_LIMIT + 1,
|
||||||
...(this.pagination.offsetMode ? {
|
...(this.pagination.offsetMode ? {
|
||||||
offset: this.offset,
|
offset: this.offset,
|
||||||
} : {
|
} : {
|
||||||
|
@ -126,7 +128,7 @@ export default (opts) => ({
|
||||||
}),
|
}),
|
||||||
...params
|
...params
|
||||||
}).then(x => {
|
}).then(x => {
|
||||||
if (x.length === (this.pagination.limit || 10) + 1) {
|
if (x.length === SECOND_FETCH_LIMIT + 1) {
|
||||||
x.pop();
|
x.pop();
|
||||||
this.items = this.items.concat(x);
|
this.items = this.items.concat(x);
|
||||||
this.more = true;
|
this.more = true;
|
||||||
|
|
Loading…
Reference in a new issue