Fixed pagination bugs
This commit is contained in:
parent
892fa05c42
commit
d6c6426aed
1 changed files with 9 additions and 1 deletions
|
@ -51,7 +51,8 @@ Vue.component('spell-item', SpellItem)
|
|||
export default {
|
||||
computed: {
|
||||
pageMax () {
|
||||
return this.spells.length / this.perPage
|
||||
let trueMax = this.spells.length / this.perPage
|
||||
return trueMax < 1 ? 1 : trueMax
|
||||
},
|
||||
pagedSpells () {
|
||||
let min = this.page * this.perPage - this.perPage
|
||||
|
@ -59,6 +60,13 @@ export default {
|
|||
return this.spells.slice(min, max)
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
pageMax (newPageMax) {
|
||||
if (this.page > newPageMax) {
|
||||
this.page = newPageMax
|
||||
}
|
||||
}
|
||||
},
|
||||
props: [
|
||||
'spells'
|
||||
],
|
||||
|
|
Loading…
Add table
Reference in a new issue