Paginated spells list
This commit is contained in:
parent
99507b0884
commit
892fa05c42
1 changed files with 36 additions and 2 deletions
|
@ -12,15 +12,33 @@
|
||||||
<big>Level</big>
|
<big>Level</big>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<q-pagination
|
||||||
|
v-model="page"
|
||||||
|
:max="pageMax"
|
||||||
|
></q-pagination>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr
|
<tr
|
||||||
is="spell-item"
|
is="spell-item"
|
||||||
v-for="spell in spells"
|
v-for="spell in pagedSpells"
|
||||||
:spell="spell"
|
:spell="spell"
|
||||||
>
|
>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
|
<tfoot>
|
||||||
|
<tr>
|
||||||
|
<td colspan="3">
|
||||||
|
<q-pagination
|
||||||
|
v-model="page"
|
||||||
|
:max="pageMax"
|
||||||
|
></q-pagination>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tfoot>
|
||||||
</table>
|
</table>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
@ -31,9 +49,25 @@ import SpellItem from './Spellitem'
|
||||||
Vue.component('spell-item', SpellItem)
|
Vue.component('spell-item', SpellItem)
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
computed: {
|
||||||
|
pageMax () {
|
||||||
|
return this.spells.length / this.perPage
|
||||||
|
},
|
||||||
|
pagedSpells () {
|
||||||
|
let min = this.page * this.perPage - this.perPage
|
||||||
|
let max = min + this.perPage
|
||||||
|
return this.spells.slice(min, max)
|
||||||
|
}
|
||||||
|
},
|
||||||
props: [
|
props: [
|
||||||
'spells'
|
'spells'
|
||||||
]
|
],
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
perPage: 10,
|
||||||
|
page: 1
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue