Skip to content

Instantly share code, notes, and snippets.

@mitrallex
Created February 4, 2018 20:58
Show Gist options
  • Save mitrallex/a4cefe13f5a184e4c0a078fed99e7e1f to your computer and use it in GitHub Desktop.
Save mitrallex/a4cefe13f5a184e4c0a078fed99e7e1f to your computer and use it in GitHub Desktop.
laravel-file-hosting
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