gpt4 book ai didi

javascript - 使用 ionic 框架无限滚动

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:26:25 25 4
gpt4 key购买 nike

我正在为 android 开发一个应用程序,我使用一个名为“Ionic Framework”的框架。这是我的问题,我必须制作一个具有“ion-infinite-scroll”无限滚动系统框架的系统。

当我在我的电脑上对 Chrome 进行测试时,我有 ion-infinite-scroll不管我在页面上的位置如何,它都不会停止。

如何放置我的代码以使系统正常工作?谢谢

Controller

$scope.loadMore = function(){
console.log("LoadMOre");



imageCache.init().then(function() {
BonjourTwitterRepository.populate($scope);
});
$scope.$broadcast('scroll.infiniteScrollComplete');
$scope.$broadcast('scroll.resize');



console.log($scope.tweetsList);
if(false){
console.log("ok");
$scope.noMoreItemsAvailable = true;

}
$scope.currentIndex = $scope.currentIndex + $scope.perPage;

};

存储库

var populateCollection = function (tweets, $scope) {
collection = new TweetCollection();
console.log($scope.currentIndex);
for (var i = $scope.currentIndex; i < $scope.perPage; i++) {
collection.addTweets(new Tweet(tweets[i], $scope, imageCache));

}
$scope.tweetsList = collection;

};

查看

    <ion-item class="item item-body">
<div class="item item-image">
<img ng-src="{{tweet.media_url}}" src="img/loading1.gif"/>
</div>
<p>
by : <a href="https//twitter.com/{{tweet.getUsername()}}">@{{tweet.getUsername()}}</a>
</p>

</ion-item>
<div class="item tabs tabs-secondary tabs-icon-left">
<p>
<a href="#" class="rating-poll"><i class="icon-thumbs-up"></i></a>
<a href="#" class="rating-poll"><i class="icon-thumbs-down"></i></a>
</p>

<p>
<button ng-click="shareThis('{{tweet.media_url}}')" class="button icon button-clear "><i
class="icon ion-share"></i>Share
</button>

</p>


</div>
</ion-list>
<ion-infinite-scroll></ion-infinite-scroll>

最佳答案

<ion-infinite-scroll 
on-infinite="fetchTrucks()"
distance="10%">
</ion-infinite-scroll>

你的无限滚动指令缺少关键属性

例子在这里 http://codepen.io/aaronksaunders/pen/gDrev

关于javascript - 使用 ionic 框架无限滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23314494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com