Add stats to pagination even on one page
This commit is contained in:
parent
71c3e98c6b
commit
26965da04f
|
@ -1,10 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="{'hidden': value.last_page == 1, 'flex': value.last_page > 1}" class="justify-between items-baseline">
|
<div class="justify-between flex items-baseline">
|
||||||
<div class="text-sm text-gray-500" v-html="desc"></div>
|
<div class="text-sm text-gray-500" v-html="desc"></div>
|
||||||
<div class="-mx-1 flex items-baseline">
|
<div class="-mx-1 items-baseline" :class="{hidden: value.last_page == 1, flex: value.last_page > 1}">
|
||||||
<div class="pl-1 pr-3 text-gray-500 text-sm">Seite:</div>
|
<div class="pl-1 pr-3 text-gray-500 text-sm">Seite:</div>
|
||||||
<div class="px-1" v-for="link, index in links" :key="index">
|
<div class="px-1" v-for="(link, index) in links" :key="index">
|
||||||
<i-link href="#" @click.prevent="goto(link)" class="rounded text-sm w-8 h-8 text-primary-100 flex items-center justify-center leading-none shadow" :key="index" v-text="link.page"
|
<i-link
|
||||||
|
href="#"
|
||||||
|
@click.prevent="goto(link)"
|
||||||
|
class="rounded text-sm w-8 h-8 text-primary-100 flex items-center justify-center leading-none shadow"
|
||||||
|
:key="index"
|
||||||
|
v-text="link.page"
|
||||||
:class="{'bg-primary-700': link.current, 'bg-primary-900': !link.current}"
|
:class="{'bg-primary-700': link.current, 'bg-primary-900': !link.current}"
|
||||||
></i-link>
|
></i-link>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,23 +25,23 @@ export default {
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
only: {
|
only: {
|
||||||
required: true
|
required: true,
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
required: true
|
required: true,
|
||||||
},
|
},
|
||||||
preserve: {
|
preserve: {
|
||||||
default: false,
|
default: false,
|
||||||
type: Boolean
|
type: Boolean,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
goto(page) {
|
goto(page) {
|
||||||
this.$inertia.visit(this.qs({page: page.page}), {
|
this.$inertia.visit(this.qs({page: page.page}), {
|
||||||
only: this.only,
|
only: this.only,
|
||||||
preserveState: this.preserve
|
preserveState: this.preserve,
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -49,7 +54,7 @@ export default {
|
||||||
for (var i = from; i <= to; i++) {
|
for (var i = from; i <= to; i++) {
|
||||||
links.push({
|
links.push({
|
||||||
page: i,
|
page: i,
|
||||||
current: i === this.value.current_page
|
current: i === this.value.current_page,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +62,7 @@ export default {
|
||||||
},
|
},
|
||||||
desc() {
|
desc() {
|
||||||
return `${this.value.from} - ${this.value.to} von ${this.value.total} Einträgen`;
|
return `${this.value.from} - ${this.value.to} von ${this.value.total} Einträgen`;
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
Loading…
Reference in New Issue