angularjs的collection-repeat用法
http://ionicframework.com/docs/api/directive/collectionRepeat/
首先摘录原文: collection-repeatSee the Pen byIonic(@ionic) onCodePen. It renders into the DOM only as many items as are currently visible. This means that on a phone screen that can fit eight items,only the eight items matching the current scroll position will be rendered. The Basics:
Performance Tips:
UsageBasic Item List (codepen)<ion-content>
<ion-item collection-repeat="item in items">
{{item}}
</ion-item>
</ion-content>
Grid of Images (<img "photo in photos"
item-width="33%"
item-height="200px"
ng-src="{{photo.url}}">
</ion-content>
API |
Attr | Type | Details |
---|---|---|
collection-repeat | expression |
The expression indicating how to enumerate a collection,of the format |
item-width
(optional)
|
The width of the repeated element. The expression must return a number (pixels) or a percentage. Defaults to the width of the first item in the list. (previously named collection-item-width) |
|
item-height
(optional)
|
The height of the repeated element. The expression must return a number (pixels) or a percentage. Defaults to the height of the first item in the list. (previously named collection-item-height) |
|
item-render-buffer
(optional)
|
number | The number of items to load before and after the visible items in the list. Default 3. Tip: set this higher if you have lots of images to preload,but don't set it too high or you'll see performance loss. |
force-refresh-images
(optional)
|
boolean | Force images to refresh as you scroll. This fixes a problem where,when an element is interchanged as scrolling,its image will still have the old src while the new src loads. Setting this to true comes with a small performance loss. |
(编辑:李大同)
【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!