
Security News
Meet Socket at Black Hat and DEF CON 2025 in Las Vegas
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
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.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.