
Security News
npm v12 Ships With Install Scripts Off by Default, Begins Deprecating 2FA-Bypass Tokens
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.
jroll-vue-infinite2
Advanced tools
<jroll-infinite class="jroll-vue-infinite"
total="10"
:jroll-options="options"
@on-scroll-bottom="scrollBottom"
@on-scroll-start="scrollStart"
@on-scroll="scroll"
@on-scroll-end="scrollEnd">
<div class='item' v-for="i in items">{{i.index}}、{{i.text}}</div>
</jroll-infinite>
Vue.component('jroll-infinite', JRoll.VueInfinite2())
注意:加载顺序必须先引入
jroll.js再引入jroll-vue-infinite2.js
npm i -D jroll
npm i -D jroll-vue-infinite2
| 选项 | 默认值 | 必填 | 说明 |
|---|---|---|---|
| total | 99 | 否 | 总页数 |
| :jroll-options | -- | 否 | 提供jroll的选项,参考http://www.chjtx.com/JRoll/#options |
| @on-scroll-bottom | -- | 是 | 滑动到底部时执行,初始化时会执行一次,用于更新数据,function (page, success, error) |
| @on-scroll-start | -- | 否 | jroll的scrollStart事件,function (jroll) |
| @on-scroll | -- | 否 | jroll的scroll事件,function (jroll) |
| @on-scroll-end | -- | 否 | jroll的scrollEnd事件,function (jroll) |
<div id="app">
<jroll-infinite class="jroll-vue-infinite" total="10" ref="myJRoll"
:jroll-options="options"
@on-scroll-bottom="scrollBottom"
@on-scroll-start="scrollStart">
<div class='item' v-for="i in items">{{i.index}}、{{i.text}}</div>
</jroll-infinite>
</div>
<script>
new Vue({
el: '#app',
data: {
page: 0,
items: [],
options: {
scrollBarY: true
}
},
mounted: function () {
// 可以通过ref属性获取jroll对象
console.log(this.$refs.myJRoll.jroll)
},
methods: {
scrollBottom: function (page, success, error) {
var me = this
ajax({
url: 'getData.do?page=' + (page + 1),
success: function (data) {
me.items = me.items.concat(data)
success()
},
error: function () {
error()
}
})
},
scrollStart: function (jroll) {
// console.log(jroll)
}
}
})
</script>
需要先引入jroll-pulldown.js,然后添加:pulldown-options选项和@on-pulldown事件
补充选项
| 选项 | 默认值 | 必填 | 说明 |
|---|---|---|---|
| :pulldown-options | -- | 是 | 添加该选项才能开启下拉刷新,可为空对象,参考https://github.com/chjtx/JRoll/tree/master/extends/jroll-pulldown,除refresh选项外,其余选项都有效 |
| @on-scroll-end | -- | 否 | jroll的scrollEnd事件,function (jroll) |
<div id="app">
<jroll-infinite class="jroll-vue-infinite" total="10" :pulldown-options="{}"
@on-scroll-bottom="scrollBottom"
@on-pulldown="pulldown">
<div class='item' v-for="i in items">{{i.index}}、{{i.text}}</div>
</jroll-infinite>
</div>
<script>
new Vue({
el: '#app',
data: {
page: 0,
items: []
},
methods: {
pulldown: function (success, error) {
var me = this
ajax({
url: 'getData.do?page=1',
success: function (data) {
me.items = data
success()
},
error: function () {
error()
}
})
},
scrollBottom: function (page, success, error) {
var me = this
ajax({
url: 'getData.do?page=' + (page + 1),
success: function (data) {
me.items = me.items.concat(data)
success()
},
error: function () {
error()
}
})
},
scrollStart: function (jroll) {
// console.log(jroll)
}
}
})
</script>
updated方法里使用$nextTick解决滑动触发更新的问题jroll-vue-infinite2FAQs
JRoll无限加载 for Vue2
The npm package jroll-vue-infinite2 receives a total of 4 weekly downloads. As such, jroll-vue-infinite2 popularity was classified as not popular.
We found that jroll-vue-infinite2 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
npm v12 is generally available, turning install scripts off by default and beginning the deprecation of 2FA-bypass publishing tokens.

Research
/Security News
Socket tracks the activity as Operation “Muck and Load”: a threat actor uses commit-farming workflows, public dead drops, and protected archives to stage Windows RAT and infostealer malware.

Security News
pnpm 11.10 hardens registry auth to block token redirection, tightens pack-app and deploy, and makes the Rust port (v12) installable.