-
-
Notifications
You must be signed in to change notification settings - Fork 85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incremental Load feature #110
Comments
I also need this for a current project |
You can achieve a load more button by doing something like the following: <template>
<div class="container is-fluid">
<client-only class="container">
<v-gallery :images="images" :index="index" @close="index = null" />
<div class="columns is-multiline">
<!-- v-gallery uses images array, where as the thumbnails below use the currentList computed variable -->
<div
class="image column is-3"
v-for="(image, imageIndex) in currentList"
:key="imageIndex"
@click="index = imageIndex"
:style="{ backgroundImage: `url('${image}')`, height: '300px' }"
></div>
<!-- On click of the following div, add 10 to the $toShow variable -->
<div
class="image column is-3 button is-primary is-large"
@click="loadMore"
:style="{ height: '300px', textAlign: 'center', lineHeight: '300px' }"
>Load more</div>
</div>
</client-only>
</div>
</div>
</template> <script>
export default {
name: "Collection",
data() {
return {
toShow: 10, // Start with 10 images
index: null,
images: []
};
},
computed: {
// Current list of images to show on page
currentList() {
// current list is a slice of the first $toShow images from $images
return this.images.slice(0, this.toShow);
}
},
methods: {
loadMore() {
this.toShow += 10;
}
}
};
</script> Then you just need to find a way of triggering loadMore when the user has scrolled to the bottom. |
Another easy solution should be using vue-infinity-scroll.js (link) like this:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Say the "images" array has a thousand elements. Would be nice to have a feature so that the images load while you scroll, like the typical "Load more" option.
Don't know if this is in the roadmap of the project.
The text was updated successfully, but these errors were encountered: