diff --git a/static/components/customer-market/customer-market.html b/static/components/customer-market/customer-market.html index a574761..1fb88b9 100644 --- a/static/components/customer-market/customer-market.html +++ b/static/components/customer-market/customer-market.html @@ -25,9 +25,17 @@ -
-
- + +
+
+ +
-
+ + +
\ No newline at end of file diff --git a/static/components/customer-market/customer-market.js b/static/components/customer-market/customer-market.js index ae76da7..0c7698c 100644 --- a/static/components/customer-market/customer-market.js +++ b/static/components/customer-market/customer-market.js @@ -15,7 +15,11 @@ async function customerMarket(path) { ], data: function () { return { - search: null + search: null, + partialProducts: [], + productsPerPage: 24, + startIndex: 0, + lastProductIndex: 0 } }, methods: { @@ -48,8 +52,23 @@ async function customerMarket(path) { pool.close(relays) await this.$emit('update-data', [...stallEvents, ...productEvents]) this.$q.loading.hide() + }, + onLoad(_, done) { + setTimeout(() => { + if (this.startIndex >= this.products.length) { + done() + return + } + this.startIndex = this.lastProductIndex + this.lastProductIndex = Math.min(this.products.length, this.lastProductIndex + this.productsPerPage) + this.partialProducts.push(...this.products.slice(this.startIndex, this.lastProductIndex)) + done() + }, 100) } }, - created() {} + created() { + this.lastProductIndex = Math.min(this.products.length, 24) + this.partialProducts.push(...this.products.slice(0, this.lastProductIndex)) + } }) }