Consolidated pagination
This commit is contained in:
parent
a8fe015e16
commit
b49a04869a
1 changed files with 3 additions and 10 deletions
|
@ -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
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue