尝试做一个无限滚动页面,在用户滚动时显示元素.
this.recordLimit += 10; this.subscribe('movements',{limit: this.recordLimit});
那个触发器(自动运行)
this.autorun(h => { if (this.ready()) { this.items = Items.find(<potential limit filter here too>); }
行.那很有效.但每次this.items = Items.find();调用后,用户的浏览器会向上滚动到顶部.
这可能是因为删除了dom元素,重置了滚动,然后再次添加元素而不恢复前一个滚动位置.
我究竟做错了什么 ?
工作中’明显’的例子:
> https://github.com/barbatus/ng-infinite-scroll/blob/master/scroll-controller.js
> https://github.com/abecks/meteor-infinite-scroll
> http://meteorpedia.com/read/Infinite_Scrolling
@ ###########编辑############ @
实际上,我注意到,在Items.find()之后放一个h.stop()来停止订阅,这个工作……我想上一个芒果游标会更新上一个订阅限制.
但是,我仍然无法理解为什么这会在最初的情况下重新粉刷一切.