
Product
Introducing Webhook Events for Pull Request Scans
Add real-time Socket webhook events to your workflows to automatically receive pull request scan results and security alerts 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 pull request scan results and security alerts in real time.
Research
The Socket Threat Research Team uncovered malicious NuGet packages typosquatting the popular Nethereum project to steal wallet keys.
Product
A single platform for static analysis, secrets detection, container scanning, and CVE checks—built on trusted open source tools, ready to run out of the box.