fix prev button being misplaced
This commit is contained in:
parent
fa2f052ba7
commit
31af345b47
2 changed files with 17 additions and 16 deletions
|
@ -3,16 +3,16 @@
|
|||
|
||||
((gl) => {
|
||||
gl.VueGlPagination = Vue.extend({
|
||||
data() {
|
||||
return {
|
||||
nslice: +this.pagenum,
|
||||
};
|
||||
},
|
||||
props: [
|
||||
'changepage',
|
||||
'count',
|
||||
'pagenum',
|
||||
],
|
||||
data() {
|
||||
return {
|
||||
nslice: +this.pagenum,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
pagenumberstatus(n) {
|
||||
if (n - 1 === +this.pagenum) return 'active';
|
||||
|
@ -24,17 +24,20 @@
|
|||
},
|
||||
},
|
||||
computed: {
|
||||
dynamicpage() {
|
||||
const section = [...Array(this.upcount).keys()];
|
||||
section.shift();
|
||||
this.nslice = +this.pagenum;
|
||||
this.endcount = +this.pagenum + 5;
|
||||
return section.slice(+this.pagenum, +this.pagenum + 5);
|
||||
},
|
||||
paginationsection() {
|
||||
if (this.last < 6 && this.pagenum < 6) {
|
||||
const pageArray = [...Array(6).keys()];
|
||||
pageArray.shift();
|
||||
return pageArray.slice(0, this.upcount);
|
||||
}
|
||||
const section = [...Array(this.upcount).keys()];
|
||||
section.shift();
|
||||
this.nslice = +this.pagenum;
|
||||
this.endcount = +this.pagenum + 5;
|
||||
return section.slice(+this.pagenum, +this.pagenum + 5);
|
||||
return this.dynamicpage;
|
||||
},
|
||||
last() {
|
||||
return Math.ceil(+this.count / 5);
|
||||
|
@ -54,7 +57,7 @@
|
|||
template: `
|
||||
<div class="gl-pagination">
|
||||
<ul class="pagination clearfix" v-for='n in paginationsection'>
|
||||
<li :class='prevstatus(n)' v-if='n - 1 === nslice'>
|
||||
<li :class='prevstatus(n)' v-if='n - 1 === 1'>
|
||||
<span @click='changepage($event, {where: pagenum - 1})'>Prev</span>
|
||||
</li>
|
||||
<li :class='pagenumberstatus(n)' v-if='n >= 2'>
|
||||
|
@ -71,16 +74,14 @@
|
|||
class="next"
|
||||
v-if='(n === upcount || n === endcount) && pagenum !== last'
|
||||
>
|
||||
<span @click='changepage($event, {where: +pagenum + 1})'>
|
||||
Next
|
||||
</span>
|
||||
<span @click='changepage($event,{where: +pagenum+1})'>Next</span>
|
||||
</li>
|
||||
<li v-if='n === upcount && upcount > 4 && endspread'>
|
||||
<span class="gap">…</span>
|
||||
</li>
|
||||
<li
|
||||
class="last"
|
||||
v-if='(n === upcount || n === endcount) && pagenum !== last'
|
||||
v-if='(n === upcount || n === endcount) && +pagenum !== last'
|
||||
>
|
||||
<span @click='changepage($event, {where: last})'>Last »</span>
|
||||
</li>
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<vue-pipelines
|
||||
:scope='scope'
|
||||
:store='store'
|
||||
:count='90'
|
||||
:count='count'
|
||||
>
|
||||
</vue-pipelines>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue