
Product
Introducing Webhook Events for Alert Changes
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.
u-infinite-scroll.vue
Advanced tools
<!-- 该 README.md 根据 api.yaml 和 docs/*.md 自动生成,为了方便在 GitHub 和 NPM 上查阅。如需修改,请查看源文件 -->
无限下拉滚动加载组件
<template>
<div infinite-scroll-container :class="$style.container">
<u-infinite-scroll
:step="step"
:lazyRows="lazyRows"
:normalizeData="normalizeData"
:getDefaultData="getDefaultData"
:loadmoreFn="loadmoreFn">
<template slot-scope="{ displayData }">
<div v-if="displayData.length > 0" v-for="(d, idx) in displayData" :key="d.timestamp">
{{d.timestamp}} : {{ d.message }}
</div>
</template>
</u-infinite-scroll>
</div>
</template>
<script>
function getRandomLengthString(p , min, max){
return p.repeat(min + (Math.floor(Math.random()*(max - min))))
}
let now = 0;
function getRandomData(){
return {
timestamp: now ++,
message: getRandomLengthString('s', 20, 30),
}
}
let fake = 0
function getRandomDefaultData(){
return {
timestamp: 'f' + (fake++),
message: getRandomLengthString('l', 20, 30),
}
}
export default {
data() {
return {
step: 50,
lazyRows: 10,
}
},
methods: {
normalizeData(data){
return data
},
getDefaultData(){
return getRandomDefaultData()
},
loadmoreFn(){
const step = this.step;
return new Promise(r => {
setTimeout(() => {
r({
total: 200,
hits: new Array(step).fill(1).map(getRandomData),
})
}, 1000 + Math.floor(Math.random(3000)))
})
}
}
}
</script>
<style module>
.container{
height: 200px;
overflow: scroll;
}
</style>
| Prop/Attr | Type | Options | Default | Description |
|---|---|---|---|---|
| step | number | 数据每次加载的条数 | ||
| lazyRows | number | 10 | 数据每次渲染的条数 | |
| normalizeData | function | 数据整理函数 data => data | ||
| getDefaultData | function | 数据未加载出来时的站位数据 | ||
| loadmoreFn | function | 加载函数,需要返回一个Promise对象,对象返回 total 和 hits 数据 |
插入文本或 HTML。
FAQs
<!-- 该 README.md 根据 api.yaml 和 docs/*.md 自动生成,为了方便在 GitHub 和 NPM 上查阅。如需修改,请查看源文件 -->
We found that u-infinite-scroll.vue 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.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.

Product
Socket now scans OpenVSX extensions, giving teams early detection of risky behaviors, hidden capabilities, and supply chain threats in developer tools.