1
0
Fork 0

Consolidated pagination

This commit is contained in:
Joe Wroten 2017-05-16 05:39:54 -05:00
parent a8fe015e16
commit b49a04869a

View file

@ -7,7 +7,7 @@
<label <label
is="spell-item" is="spell-item"
class="item two-lines item-link" class="item two-lines item-link"
v-for="spell in pagedSpells" v-for="spell in filteredSpells"
:spell="spell" :spell="spell"
> >
</label> </label>
@ -33,18 +33,11 @@ export default {
} }
}, },
computed: { computed: {
dynamicSortBy () {
return this.search.length >= 3 ? 'sortScore' : this.sortBy
},
pagedSpells () {
return new Query(this.filteredSpells)
.paginate(1, this.loadedPage * 20)
.results
},
filteredSpells () { filteredSpells () {
return new Query(this.spells) return new Query(this.spells)
.search('name', this.search, 5) .search('name', this.search)
.sort(this.sortBy) .sort(this.sortBy)
.paginate(1, this.loadedPage * 20)
.results .results
} }
}, },