Ionic Load More 滚动缓慢
Ionic Load More scrolling slow
嗨,我是 Ionic 的新手,而且,
我在这里使用 AngularJS 和 Ionic v1 加载更多滚动 太慢了。
我试过两种方法
服务
工厂
两种方式都很慢。我怎样才能加快加载更多选项的速度。
这些是我从 api REST 服务
获得的值
{
"shared_status": "false",
"wall_post_id": "740",
"post_post": "getU.online",
"post_added_by": "589",
"post_company_name": "The Business Club",
"post_business_sector": null,
"post_busin_type": "Limited Company",
"post_added_by_image": "1471523735.png",
"post_added_by_name": "Russ Wheeler",
"post_added_on": "14 hours ago",
"post_date": "2017-01-31 18:48:36",
"post_mine": true,
"image_list": [{
"file_name": "http:\/\/www.domain.com\/uploads\/wall_posts\/tmp\/\/1485888514.jpg"
}],
"like_status": "activated",
"like_test": false,
"like_test_1": "Unlike",
"like": " Like",
"num_like": "1",
"no_of_reply": 1,
"comment": "comment"
}
尽可能只使用 ionic 指令,因为它们的设计考虑到了移动性能。使用 non-ionic 指令会以牺牲性能为代价。
因此,如果您正在使用一些基于自定义/插件的解决方案.. 删除它并改用 <ion-infinite-scroll>
这是示例:
<ion-infinite-scroll
ng-if="moreDataCanBeLoaded()"
icon="ion-loading-c"
on-infinite="loadMoreData()">
</ion-infinite-scroll>
Read more :
https://ionicframework.com/docs/api/directive/ionInfiniteScroll/
首先检查您的 API 通话延迟。如果他们没问题,请使用以下内容
增加离子应用程序性能加载列表等。
尝试做以下事情。
- 添加 crosswalk plugin(这会增加您的 .apk 文件大小,但从性能角度来看,这将是一个不错的选择)
- 如果您可以在列表项中使用 one time data-binding(::),请使用它
- 在你的 ng-repeat 列表项中使用跟踪(例如 ng-repeat="item in items track by item.id" 或 ng-repeat="item in items track by $index")
- 在生产中应用时删除 console.log 如果有
您还可以在此 link
中找到更多性能提示
嗨,我是 Ionic 的新手,而且, 我在这里使用 AngularJS 和 Ionic v1 加载更多滚动 太慢了。 我试过两种方法
服务
工厂
两种方式都很慢。我怎样才能加快加载更多选项的速度。
这些是我从 api REST 服务
获得的值{
"shared_status": "false",
"wall_post_id": "740",
"post_post": "getU.online",
"post_added_by": "589",
"post_company_name": "The Business Club",
"post_business_sector": null,
"post_busin_type": "Limited Company",
"post_added_by_image": "1471523735.png",
"post_added_by_name": "Russ Wheeler",
"post_added_on": "14 hours ago",
"post_date": "2017-01-31 18:48:36",
"post_mine": true,
"image_list": [{
"file_name": "http:\/\/www.domain.com\/uploads\/wall_posts\/tmp\/\/1485888514.jpg"
}],
"like_status": "activated",
"like_test": false,
"like_test_1": "Unlike",
"like": " Like",
"num_like": "1",
"no_of_reply": 1,
"comment": "comment"
}
尽可能只使用 ionic 指令,因为它们的设计考虑到了移动性能。使用 non-ionic 指令会以牺牲性能为代价。
因此,如果您正在使用一些基于自定义/插件的解决方案.. 删除它并改用 <ion-infinite-scroll>
这是示例:
<ion-infinite-scroll
ng-if="moreDataCanBeLoaded()"
icon="ion-loading-c"
on-infinite="loadMoreData()">
</ion-infinite-scroll>
Read more : https://ionicframework.com/docs/api/directive/ionInfiniteScroll/
首先检查您的 API 通话延迟。如果他们没问题,请使用以下内容 增加离子应用程序性能加载列表等。 尝试做以下事情。
- 添加 crosswalk plugin(这会增加您的 .apk 文件大小,但从性能角度来看,这将是一个不错的选择)
- 如果您可以在列表项中使用 one time data-binding(::),请使用它
- 在你的 ng-repeat 列表项中使用跟踪(例如 ng-repeat="item in items track by item.id" 或 ng-repeat="item in items track by $index")
- 在生产中应用时删除 console.log 如果有
您还可以在此 link
中找到更多性能提示