tab2.page.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <ion-header>
  2. <ion-toolbar>
  3. <ion-title>文库</ion-title>
  4. </ion-toolbar>
  5. <ion-segment (ionChange)="segmentChanged($event)">
  6. <ion-segment-button value="categories">
  7. <ion-label>分类</ion-label>
  8. </ion-segment-button>
  9. <ion-segment-button value="works">
  10. <ion-label>作品</ion-label>
  11. </ion-segment-button>
  12. </ion-segment>
  13. </ion-header>
  14. <ion-content>
  15. <div [ngSwitch]="selectedSegment">
  16. <div *ngSwitchCase="'categories'">
  17. <ion-grid>
  18. <ion-row>
  19. <ion-col size="3" *ngFor="let category of categories">
  20. <ion-card>
  21. <ion-card-content>
  22. <ion-icon name="book"></ion-icon>
  23. <ion-label>{{ category.name }}</ion-label>
  24. </ion-card-content>
  25. </ion-card>
  26. </ion-col>
  27. </ion-row>
  28. </ion-grid>
  29. </div>
  30. <div *ngSwitchCase="'works'">
  31. <ion-item>
  32. <ion-label>朝代</ion-label>
  33. <ion-select [(ngModel)]="selectedDynasty">
  34. <ion-select-option *ngFor="let dynasty of dynasties" [value]="dynasty">{{ dynasty }}</ion-select-option>
  35. </ion-select>
  36. </ion-item>
  37. <ion-item>
  38. <ion-label>作者</ion-label>
  39. <ion-select [(ngModel)]="selectedAuthor">
  40. <ion-select-option *ngFor="let author of authors" [value]="author">{{ author }}</ion-select-option>
  41. </ion-select>
  42. </ion-item>
  43. <ion-list>
  44. <ion-item *ngFor="let poem of filteredPoems">
  45. <ion-label>
  46. <h2>{{ poem.title }}</h2>
  47. <p>{{ poem.dynasty }} / {{ poem.author }}</p>
  48. <p>{{ poem.firstLine }}</p>
  49. </ion-label>
  50. </ion-item>
  51. </ion-list>
  52. </div>
  53. </div>
  54. </ion-content>