Commit ae5dc479 authored by Regis's avatar Regis

fix pagination UI

parent 7c86c611
...@@ -98,9 +98,9 @@ ...@@ -98,9 +98,9 @@
if (page > 1) items.push({ title: FIRST }); if (page > 1) items.push({ title: FIRST });
if (page > 1) { if (page > 1) {
items.push({ title: PREV }); items.push({ title: PREV, prev: true });
} else { } else {
items.push({ title: PREV, disabled: true }); items.push({ title: PREV, disabled: true, prev: true });
} }
if (page > UI_LIMIT) items.push({ title: SPREAD, separator: true }); if (page > UI_LIMIT) items.push({ title: SPREAD, separator: true });
...@@ -110,29 +110,32 @@ ...@@ -110,29 +110,32 @@
for (let i = start; i <= end; i++) { for (let i = start; i <= end; i++) {
const isActive = i === page; const isActive = i === page;
items.push({ title: i, active: isActive }); items.push({ title: i, active: isActive, page: true });
} }
if (total - page > PAGINATION_UI_BUTTON_LIMIT) { if (total - page > PAGINATION_UI_BUTTON_LIMIT) {
items.push({ title: SPREAD, separator: true }); items.push({ title: SPREAD, separator: true, page: true });
} }
if (page === total) { if (page === total) {
items.push({ title: NEXT, disabled: true }); items.push({ title: NEXT, disabled: true, next: true });
} else if (total - page >= 1) { } else if (total - page >= 1) {
items.push({ title: NEXT }); items.push({ title: NEXT, next: true });
} }
if (total - page >= 1) items.push({ title: LAST }); if (total - page >= 1) items.push({ title: LAST, last: true });
return items; return items;
}, },
}, },
template: ` template: `
<div class="gl-pagination"> <div class="gl-pagination">
<ul class="pagination clearfix" v-for='item in getItems'> <ul class="pagination clearfix">
<li <li v-for='item in getItems'
:class='{ :class='{
page: item.page,
prev: item.prev,
next: item.next,
separator: item.separator, separator: item.separator,
active: item.active, active: item.active,
disabled: item.disabled disabled: item.disabled
......
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