Created
February 4, 2018 20:58
-
-
Save mitrallex/a4cefe13f5a184e4c0a078fed99e7e1f to your computer and use it in GitHub Desktop.
laravel-file-hosting
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| computed: { | |
| pages() { | |
| let pages = []; | |
| let from = this.pagination.current_page - Math.floor(this.offset / 2); | |
| if (from < 1) { | |
| from = 1; | |
| } | |
| let to = from + this.offset - 1; | |
| if (to > this.pagination.last_page) { | |
| to = this.pagination.last_page; | |
| } | |
| while (from <= to) { | |
| pages.push(from); | |
| from++; | |
| } | |
| return pages; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment