import { Component } from '@angular/core'; import { Router } from '@angular/router'; @Component({ selector: 'app-crop-intro', templateUrl: './crop-intro.page.html', styleUrls: ['./crop-intro.page.scss'], }) export class CropIntroPage { crops = [ { id: 1, name: '小麦', image: 'assets/images/wheat.jpg', summary: '主要粮食作物,耐寒性强', season: '冬季', details: '小麦是我国北方主要粮食作物...' }, { id: 2, name: '水稻', image: 'assets/images/rice.jpg', summary: '喜水作物,南方主要粮食', season: '夏季', details: '水稻是我国南方主要粮食作物...' }, { id: 3, name: '玉米', image: 'assets/images/corn.jpg', summary: '高产作物,用途广泛', season: '夏季', details: '玉米是我国重要的粮食和饲料作物...' } ]; constructor(private router: Router) {} openCropDetail(crop: any) { this.router.navigate(['/crop-detail', crop.id]); } }