Commit 31af345b authored by Regis's avatar Regis

fix prev button being misplaced

parent fa2f052b
......@@ -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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment