bottom-nav.component.ts 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { Component, Input } from '@angular/core';
  2. import { CommonModule } from '@angular/common';
  3. import { Router, RouterModule } from '@angular/router';
  4. @Component({
  5. selector: 'app-bottom-nav',
  6. standalone: true,
  7. imports: [CommonModule, RouterModule],
  8. templateUrl: './bottom-nav.component.html',
  9. styleUrls: ['./bottom-nav.component.scss']
  10. })
  11. export class BottomNavComponent {
  12. @Input() activeTab: 'home' | 'booking' | 'earnings' | 'mall' | 'profile' = 'home';
  13. constructor(private router: Router) {}
  14. navigate(tab: 'home' | 'booking' | 'earnings' | 'mall' | 'profile') {
  15. if (this.activeTab === tab) return;
  16. switch (tab) {
  17. case 'home':
  18. this.router.navigate(['/consumer/home']);
  19. break;
  20. case 'booking':
  21. this.router.navigate(['/consumer/booking-recycle']);
  22. break;
  23. case 'earnings':
  24. this.router.navigate(['/consumer/earnings']);
  25. break;
  26. case 'mall':
  27. this.router.navigate(['/consumer/points-mall']);
  28. break;
  29. case 'profile':
  30. this.router.navigate(['/consumer/profile']);
  31. break;
  32. }
  33. }
  34. }