- larvale version 5.6 to 5.8
This commit is contained in:
parent
a2967b90ee
commit
265cfbcd30
43 changed files with 925 additions and 246 deletions
50
resources/js/search/search-results/vs-pagination-class.ts
Normal file
50
resources/js/search/search-results/vs-pagination-class.ts
Normal file
|
@ -0,0 +1,50 @@
|
|||
import { Vue, Component, Prop } from 'vue-property-decorator';
|
||||
// import Vue from "vue";
|
||||
|
||||
@Component
|
||||
export default class VsPagination extends Vue {
|
||||
|
||||
pageNumber: number = 0; // default to page 0
|
||||
|
||||
@Prop()
|
||||
data;
|
||||
|
||||
@Prop({ default: 4 }) readonly offset: number;
|
||||
|
||||
changePage(page) {
|
||||
if (page == this.data.current_page) {
|
||||
return;
|
||||
}
|
||||
this.data.current_page = page;
|
||||
let from = (page * this.data.per_page) - this.data.per_page;
|
||||
this.$emit('paginate', from);
|
||||
}
|
||||
|
||||
get numberOfPages() {
|
||||
return Math.ceil(this.data.total / this.data.per_page);
|
||||
}
|
||||
|
||||
get pages() {
|
||||
let numberOfPages = Math.ceil(this.data.total / this.data.per_page);
|
||||
|
||||
// if (!this.data.to) {
|
||||
// return [];
|
||||
// }
|
||||
let from = this.data.current_page - this.data.per_page;
|
||||
if (from < 1) {
|
||||
from = 1;
|
||||
}
|
||||
let to = from + (this.data.per_page * 2);
|
||||
if (to >= numberOfPages) {
|
||||
to = numberOfPages;
|
||||
}
|
||||
let pagesArray = [];
|
||||
for (let page = from; page <= to; page++) {
|
||||
pagesArray.push(page);
|
||||
}
|
||||
return pagesArray;
|
||||
}
|
||||
|
||||
mounted() {
|
||||
}
|
||||
}
|
Loading…
Add table
editor.link_modal.header
Reference in a new issue