Commit b0e6d078 authored by Regis's avatar Regis

end dot logic complete

parent 31af345b
...@@ -29,7 +29,12 @@ ...@@ -29,7 +29,12 @@
section.shift(); section.shift();
this.nslice = +this.pagenum; this.nslice = +this.pagenum;
this.endcount = +this.pagenum + 5; this.endcount = +this.pagenum + 5;
return section.slice(+this.pagenum, +this.pagenum + 5); if (+this.pagenum + 5 <= this.last) {
return section.slice(+this.pagenum, +this.pagenum + 5);
}
if (+this.pagenum + 5 > this.last) {
return section.slice(this.last - 5, this.last);
}
}, },
paginationsection() { paginationsection() {
if (this.last < 6 && this.pagenum < 6) { if (this.last < 6 && this.pagenum < 6) {
...@@ -46,7 +51,7 @@ ...@@ -46,7 +51,7 @@
return +this.last + 1; return +this.last + 1;
}, },
endspread() { endspread() {
if (+this.pagenum < this.last && +this.pagenum > 5) return true; if (+this.pagenum < this.last) return true;
return false; return false;
}, },
begspread() { begspread() {
...@@ -57,17 +62,19 @@ ...@@ -57,17 +62,19 @@
template: ` template: `
<div class="gl-pagination"> <div class="gl-pagination">
<ul class="pagination clearfix" v-for='n in paginationsection'> <ul class="pagination clearfix" v-for='n in paginationsection'>
<li :class='prevstatus(n)' v-if='n - 1 === 1'> <li
:class='prevstatus(n)'
v-if='n - 1 === 1 || n - 1 === nslice || n - 1 === this.last - 5'
>
<span @click='changepage($event, {where: pagenum - 1})'>Prev</span> <span @click='changepage($event, {where: pagenum - 1})'>Prev</span>
</li> </li>
<li v-if='n - 1 === last && upcount > 4 && begspread'>
<span class="gap">…</span>
</li>
<li :class='pagenumberstatus(n)' v-if='n >= 2'> <li :class='pagenumberstatus(n)' v-if='n >= 2'>
<span @click='changepage($event)'>{{(n - 1)}}</span> <span @click='changepage($event)'>{{(n - 1)}}</span>
</li> </li>
<!-- <li v-if='(n === upcount || n === endcount) && +pagenum + 5 !== last'>
if at end make dots dissapear
if in second slice or more make dots appear in the front
-->
<li v-if='n === upcount && upcount > 4 && begspread'>
<span class="gap">…</span> <span class="gap">…</span>
</li> </li>
<li <li
...@@ -76,9 +83,6 @@ ...@@ -76,9 +83,6 @@
> >
<span @click='changepage($event,{where: +pagenum+1})'>Next</span> <span @click='changepage($event,{where: +pagenum+1})'>Next</span>
</li> </li>
<li v-if='n === upcount && upcount > 4 && endspread'>
<span class="gap">…</span>
</li>
<li <li
class="last" class="last"
v-if='(n === upcount || n === endcount) && +pagenum !== last' v-if='(n === upcount || n === endcount) && +pagenum !== last'
......
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
<vue-pipelines <vue-pipelines
:scope='scope' :scope='scope'
:store='store' :store='store'
:count='count' :count='90'
> >
</vue-pipelines> </vue-pipelines>
</div> </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