Akryum / Akryum/vue-virtual-scroller

Axios example

Open
#283 3 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
TypeScript
Stars
10.8k
Forks
973
PR merge metrics
No merged PRs in 30d

Description

Hi guys,

Its possible to integrate with dinamic content using axios calls?




Última hora









export default {
name: 'Home',
data() {
return {
deals: {
total: 0,
results: [],
},
vscroll: {
page: 1,
height: 227,

},
};
},
watch: {
'vscroll.page': function (to, from) {
if (to > from) {
this.list();
}
},
},
beforeRouteEnter(to, from, next) {
next(async (vm) => {
const deals = await vm.$root.deals().list(vm.deals.length);

if (deals.ok) {
vm.deals.results = deals.data.results;
vm.deals.total = deals.data.total;
}

vm.loaded = true;

return true;
});
},
methods: {
async list() {
const deals = await this.$root.deals().list(this.deals.results.length);

if (deals.ok) {
this.deals.total = deals.data.total;
deals.data.results.forEach((item) => {
this.deals.results.push(item);
});
}
},
getProps(itemIndex) {
return {
key: itemIndex,
props: {
deal: this.deals.results[itemIndex],
user: this.deals.results[itemIndex].user,
},
};
},
scrolling(event) {
const windowHeight = event.target.clientHeight;
this.vscroll.page = Math.round(event.target.scrollTop / windowHeight) + 1;
},
},
};

I try call more items while scroll bottom but all items displayed in my dom:

I dont find any virtual infinite scroll library with ajax examples

![](https://i.gyazo.com/d63f161a5c5218ab4b3c72de70abe85a.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.