import { Component } from '@angular/core';
import { NavMobileTabsComponent } from '../nav-mobile-tabs/nav-mobile-tabs.component';
import { PageDesignComponent } from '../page-design/page-design.component';
import { PageIpComponent } from '../page-ip/page-ip.component';
import { PageMineComponent } from '../page-mine/page-mine.component';
import { PageTrendsComponent } from '../page-trends/page-trends.component';
import { CommonModule } from '@angular/common';

@Component({
  selector: 'app-page-home',
  standalone: true,
  imports: [
    CommonModule,
    NavMobileTabsComponent,
    PageDesignComponent,
    PageIpComponent,
    PageMineComponent,
    PageTrendsComponent
  ],
  templateUrl: './page-home.html',
  styleUrls: ['./page-home.scss']
})
export class PageHomeComponent {
  // 添加当前标签状态属性
  currentTab: string = 'design'; // 默认显示设计页

  // 正确接收标签变化事件
  onTabChanged(tabName: string): void {
    // 更新当前活动标签
    this.currentTab = tabName;
    console.log('标签切换至:', tabName);
    
    // 这里可以添加切换内容后的其他逻辑
    // 例如：滚动到页面顶部
    window.scrollTo(0, 0);
    
    // 或者：重置页面状态
    // this.resetPageState();
  }
}