
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
infinite-loading-vue3
Advanced tools
An infinite scroll component for Vue 3.0 apps
npm install infinite-loading-vue3
import InfiniteScroll from "infinite-loading-vue3";
<script>
export default {
components: {
InfiniteScroll
}
}
</script>
<template>
<div>
<infinite-scroll @infinite-scroll="loadDataFromServer">
<!-- Place the content of your page here. E.g a list of resources being fetched from a server -->
</infinite-scroll>
</div>
</template>
NB:
The InfinitesScroll components displays error messages if no result was fetched or if there was an error in the API request. Awesome right 😁.
This can be enabled by the following two props.
1. noResult: It is used to inform the component that no data was returned from the server either because a user has
reached the end of the pages and an empty array was returned or because there was an error in the API Call.
2. message: Here, you can provide custom error messages that you want to display to users.
Let's see the infinite-loading-vue3 package in action.
We will be making a call to GITHUB API and fetch a list of trending repositories. As users scroll to the bottom of the page, results from the next page will be fetched.
<template>
<div id="app">
<infinite-scroll
@infinite-scroll="loadDataFromServer"
:message="message"
:noResult="noResult"
>
<div>
<div
v-for="repo in trendingRepos"
:key="repo.id"
style="margin-bottom: 20px"
>
<div>
<img :src="repo.owner.avatar_url" alt="" style="height: 50px">
</div>
<div>{{repo.name}}</div>
</div>
</div>
</infinite-scroll>
</div>
</template>
<script>
import InfiniteScroll from 'infinite-loading-vue3';
import axios from "axios";
export default {
name: 'TrendingRepos',
components: {
InfiniteScroll
},
data() {
return {
trendingRepos: [],
page: 1,
noResult: false,
message: ""
}
},
methods: {
async loadDataFromServer(){
try {
const result = await axios.get(`https://api.github.com/search/repositories?q=created:>2017-10-22&sort=stars&order=desc&page=${this.page}`)
if(result.data.items.length) {
this.trendingRepos.push(...result.data.items);
this.page++;
} else {
this.noResult = true;
this.message = "No result found";
}
} catch(err) {
this.noResult = true;
this.message = "Error loading data";
}
}
},
mounted() {
this.loadDataFromServer()
}
}
</script>
FAQs
An infinite scroll component for Vue 3.0 apps
The npm package infinite-loading-vue3 receives a total of 61 weekly downloads. As such, infinite-loading-vue3 popularity was classified as not popular.
We found that infinite-loading-vue3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.