import { Component } from '@angular/core';
import { IonicModule } from '@ionic/angular';
import { CommonModule } from '@angular/common';
import { FormsModule } from '@angular/forms';

@Component({
  selector: 'app-tab2',
  templateUrl: 'tab2.page.html',
  styleUrls: ['tab2.page.scss'],
  standalone: true,
  imports: [
    IonicModule,
    CommonModule,
    FormsModule
  ]
})
export class Tab2Page {
  selectedSegment: string = 'collection';
  books: any[] = [
    { title: '唐诗鉴赏辞典', count: 1100 },
    { title: '宋词鉴赏辞典', count: 1294 },
    { title: '元曲鉴赏辞典', count: 712 },
    { title: '元明清诗鉴赏辞典', count: 840 },
    { title: '现代女性诗词鉴赏辞典', count: 652 },
    { title: '古文鉴赏辞典', count: 566 },
    { title: '明清小说鉴赏辞典', count: 243 },
    { title: '古代志怪小说鉴赏辞典', count: 539 },
  ];
  filteredBooks: any[] = [];

  constructor() {
    this.filteredBooks = this.books;
  }

  segmentChanged(event: any) {
    this.filteredBooks = this.books; // 示例，实际可根据需要调整
  }

  selectBook(book: any) {
    console.log('Selected book:', book);
  }

  openSearch() {
    console.log('Search clicked');
  }
}