<v-pagination
v-model="pagination.current"
:length="pagination.total"
@input="onPageChange"
></v-pagination>
export default {
data() {
return {
users: null,
pagination: {
current: 1,
total: 0
}
}
},
methods: {
getUsers() {
window.axios.get('/api/users?page=' + this.pagination.current)
.then(response => {
this.users = response.data.data;
this.pagination.current = response.data.current_page;
this.pagination.total = response.data.last_page;
});
},
onPageChange() {
this.getUsers();
}
},
mounted() {
this.getUsers();
}
}