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;
case LAST:
pageNum = totalPages; pageNum = totalPages;
} else if (text === NEXT) { break;
case NEXT:
pageNum = nextPage; pageNum = nextPage;
} else if (text === PREV) { break;
case PREV:
pageNum = previousPage; pageNum = previousPage;
} else if (text === FIRST) { break;
case FIRST:
pageNum = 1; pageNum = 1;
} else { break;
default:
pageNum = +text; 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