Skip to content
Snippets Groups Projects
Commit 2b29a856 authored by Henrik Askjer's avatar Henrik Askjer
Browse files

WIP bottom pagination

parent ef9a4beb
No related branches found
No related tags found
No related merge requests found
<template>
<div v-bind:class="{'centered': bottom}">
<span color="tertiary" class = "pagination" v-if="!$parent.$parent.article && $parent.$parent.article_info && ($parent.count_bm > $parent.$parent.perPage || $parent.count_nn > $parent.$parent.perPage)">
<v-pagination @input="update" v-model="$parent.$parent.page" :class="$vuetify.breakpoint.name" :total-visible="$vuetify.breakpoint.smAndDown ? 5 : 8" circle :length="Math.ceil(Math.max($parent.count_bm, $parent.count_nn)/$parent.$parent.perPage)"></v-pagination>
<span class="result-counts" v-if="!bottom">
......@@ -6,8 +7,11 @@
<span v-if="$parent.$parent.lang=='bm,nn'" class="dict-counts"> | {{$vuetify.breakpoint.mdAndDown? 'bokmål': 'Bokmålsordboka'}}: {{$parent.count_bm}} | {{$vuetify.breakpoint.mdAndDown? 'nynorsk': 'Nynorskordboka'}}: {{$parent.count_nn}}</span>
<span v-if="$parent.$parent.lang!='bm,nn'" class="dict-counts"> | {{$t('dicts_inline.'+$parent.lang)}}</span>
</span>
<v-btn v-if="$vuetify.breakpoint.mobile" text @click.native="to_top"><v-icon left>expand_less</v-icon>Til toppen</v-btn>
</span>
<v-btn v-if="bottom && $vuetify.breakpoint.mobile && detect_height" text @click.native="to_top"><v-icon left>expand_less</v-icon>Til toppen</v-btn>
</div>
</template>
<script>
......@@ -17,6 +21,13 @@ export default ({
props: {
bottom: Boolean
},
computed: {
detect_height: function() {
console.log(document.body.scrollHeight > 1.5 * window.innerHeight)
return document.body.scrollHeight > 1.5 * window.innerHeight
}
},
methods: {
update: function(item) {
if (this.bottom) {
......@@ -28,7 +39,18 @@ export default ({
},
to_top: function() {
window.scrollTo(0,0)
}
}
}
},
})
</script>
<style scoped>
.centered {
width: 100%;
justify-content: center;
text-align: center;
padding-bottom: 10px;
}
</style>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment