crop-intro.page.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { Component } from '@angular/core';
  2. import { Router } from '@angular/router';
  3. @Component({
  4. selector: 'app-crop-intro',
  5. templateUrl: './crop-intro.page.html',
  6. styleUrls: ['./crop-intro.page.scss'],
  7. })
  8. export class CropIntroPage {
  9. crops = [
  10. {
  11. id: 1,
  12. name: '小麦',
  13. image: 'assets/images/wheat.jpg',
  14. summary: '主要粮食作物,耐寒性强',
  15. season: '冬季',
  16. details: '小麦是我国北方主要粮食作物...'
  17. },
  18. {
  19. id: 2,
  20. name: '水稻',
  21. image: 'assets/images/rice.jpg',
  22. summary: '喜水作物,南方主要粮食',
  23. season: '夏季',
  24. details: '水稻是我国南方主要粮食作物...'
  25. },
  26. {
  27. id: 3,
  28. name: '玉米',
  29. image: 'assets/images/corn.jpg',
  30. summary: '高产作物,用途广泛',
  31. season: '夏季',
  32. details: '玉米是我国重要的粮食和饲料作物...'
  33. }
  34. ];
  35. constructor(private router: Router) {}
  36. openCropDetail(crop: any) {
  37. this.router.navigate(['/crop-detail', crop.id]);
  38. }
  39. }