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 {
|
export default {
|
||||||
computed: {
|
computed: {
|
||||||
pageMax () {
|
pageMax () {
|
||||||
return this.spells.length / this.perPage
|
let trueMax = this.spells.length / this.perPage
|
||||||
|
return trueMax < 1 ? 1 : trueMax
|
||||||
},
|
},
|
||||||
pagedSpells () {
|
pagedSpells () {
|
||||||
let min = this.page * this.perPage - this.perPage
|
let min = this.page * this.perPage - this.perPage
|
||||||
|
@ -59,6 +60,13 @@ export default {
|
||||||
return this.spells.slice(min, max)
|
return this.spells.slice(min, max)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
pageMax (newPageMax) {
|
||||||
|
if (this.page > newPageMax) {
|
||||||
|
this.page = newPageMax
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
props: [
|
props: [
|
||||||
'spells'
|
'spells'
|
||||||
],
|
],
|
||||||
|
|
Loading…
Add table
Reference in a new issue