Commit 79f6e08c authored by Regis's avatar Regis

use switch for pagination

parent 6bf0bd0f
...@@ -66,18 +66,24 @@ ...@@ -66,18 +66,24 @@
const text = e.target.innerText; const text = e.target.innerText;
const { totalPages, nextPage, previousPage } = this.pageInfo; const { totalPages, nextPage, previousPage } = this.pageInfo;
if (text === SPREAD) { switch (text) {
return; case SPREAD:
} else if (text === LAST) { break;
pageNum = totalPages; case LAST:
} else if (text === NEXT) { pageNum = totalPages;
pageNum = nextPage; break;
} else if (text === PREV) { case NEXT:
pageNum = previousPage; pageNum = nextPage;
} else if (text === FIRST) { break;
pageNum = 1; case PREV:
} else { pageNum = previousPage;
pageNum = +text; break;
case FIRST:
pageNum = 1;
break;
default:
pageNum = +text;
break;
} }
this.change(pageNum, apiScope); this.change(pageNum, apiScope);
......
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