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 = [ // { // name:'教材管理', // id:'5', // child:[ // { // name:'教材列表', // id:'1-1', // path:"/nav-author/textbook/list" // } // ] // }, { name:'个人空间', id:'1', child:[ { name:'创建教材', id:'1-1', path:"/nav-author/textbook/list" }, { name:'教材列表', id:'1-2', path:"/nav-author/manage/textbook/list" }, ] }, { name:'回收站', id:'2', path:'/nav-author/apply' }, { name:'个人信息', id:'3', path:"/nav-author/profile" }, ] 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) } }