contact-list.page.html 1.2 KB

12345678910111213141516171819202122232425262728293031323334
  1. <ion-header [translucent]="true">
  2. <ion-toolbar>
  3. <ion-title>通讯录</ion-title>
  4. </ion-toolbar>
  5. </ion-header>
  6. <ion-content [fullscreen]="true">
  7. <ion-header collapse="condense">
  8. <ion-toolbar>
  9. <ion-title size="large">通讯录</ion-title>
  10. </ion-toolbar>
  11. </ion-header>
  12. <ion-searchbar [(ngModel)]="searchName" (ionInput)="search()"></ion-searchbar>
  13. <ion-list>
  14. <ng-container *ngFor="let contact of contactList;let index = index;">
  15. <!-- 分组:根据下标首个出现的元素显示分组分隔符 -->
  16. <ion-item-divider *ngIf="charGroupIndex[contact.get('firstChar')] == index">
  17. <ion-label>{{contact.get('firstChar')}}</ion-label>
  18. </ion-item-divider>
  19. <ion-item lines="none">
  20. <ion-avatar slot="start">
  21. <img [src]="contact.get('avatarUrl') || 'https://ionicframework.com/docs/img/demos/avatar.svg'">
  22. </ion-avatar>
  23. <ion-label>
  24. <h2>{{ contact.get('name') }}</h2>
  25. <p>性别: {{ contact.get('gender') }}</p>
  26. <p>手机: {{ contact.get('mobile') }}</p>
  27. </ion-label>
  28. </ion-item>
  29. </ng-container>
  30. </ion-list>
  31. </ion-content>