import { Component, Input } from '@angular/core';
import { CommonModule } from '@angular/common';
import { Router } from '@angular/router'; // 添加导入

@Component({
  selector: 'app-history-item',
  standalone: true,
  imports: [CommonModule],
  templateUrl: './history-item.component.html',
  styleUrls: ['./history-item.component.scss']
})
export class HistoryItemComponent {
  @Input() item: any;
  
  constructor(private router: Router) {} // 注入Router
  
  // 添加导航方法
  navigateToMenu() {
    if (this.item.name === '点菜喵主题餐厅') {
      this.router.navigate(['/menus']);
    }
  }
}