From e0b37bbf33063735590a01e07253a6cec80679e7 Mon Sep 17 00:00:00 2001 From: Joe Wroten Date: Wed, 10 May 2017 16:39:14 -0500 Subject: [PATCH] Pagination query func is chainable now --- src/components/Spelllist.vue | 1 + src/query.js | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Spelllist.vue b/src/components/Spelllist.vue index 7a9ffca..b010196 100644 --- a/src/components/Spelllist.vue +++ b/src/components/Spelllist.vue @@ -64,6 +64,7 @@ export default { pagedSpells () { return new Query(this.sortedSpells) .paginate(this.page, this.perPage) + .results }, sortedSpells () { return this.spells diff --git a/src/query.js b/src/query.js index 7975a01..02daf2e 100644 --- a/src/query.js +++ b/src/query.js @@ -34,6 +34,7 @@ export default class Query { paginate (page = 1, perPage = 10) { let min = page * perPage - perPage let max = min + perPage - return this.data.slice(min, max) + this.data = this.data.slice(min, max) + return this } }