import { Component, OnInit } from '@angular/core';
import { CompNavComponent } from '../../../app/comp-nav/comp-nav.component'
import { RouterOutlet, Router } from '@angular/router';
import { CommonCompModule } from '../../../services/common.modules'

@Component({
  selector: 'app-page-home',
  standalone: true,
  imports: [CompNavComponent,RouterOutlet,CommonCompModule],
  templateUrl: './page-home.component.html',
  styleUrls: ['./page-home.component.scss'],
})
export class PageHomeComponent  implements OnInit {

  options:Array<any> = [
    {
      name:'教材管理',
      id:'1',
      child:[
        {
          name:'教材列表',
          id:'1-1',
          path:"/nav-author/textbook/list"
        }
      ]
    },
    {
      name:'个人空间',
      id:'1',
    },
    {
      name:'回收站',
      id:'2',
    },
    {
      name:'个人信息',
      id:'3',
    },
  ]
  active:string = localStorage.getItem('active') || this.options[0].id
  constructor(
    public router: Router,
  ) { }

  ngOnInit() {}
  toUrl(child:any){
    let cateid = child.id
    this.active = cateid
    localStorage.setItem('active', cateid)
    console.log(child)
    child?.path&&this.router.navigateByUrl(child?.path)
  }
}
