import { Component , OnInit , Input } from '@angular/core' ; import { PlatformCoreService } from 'src/app/services/platform/platform-core.service' ; import { Router } from '@angular/router' ; import { MenuItem } from 'src/app/models/core/menuItem' ; @ Component ( { selector : 'app-sidebar' , templateUrl : './sidebar.component.html' , styleUrls : [ './sidebar.component.css' ] } ) export class SidebarComponent implements OnInit { @ Input ( ) isCollapsed : boolean ; isShow : boolean ; /**
     * 菜单资源
     */ menuResource : Array < MenuItem > = [ ] ; constructor ( private platformCoreService , private router ) { } ngOnInit ( ) { this . platformCoreService . getMenuResource ( this . menuResource ) ; } isSelected ( module ) { const u = this . router . url ; return module === u ; } isOpen ( menuItems ) { const u = this . router . url ; const foucusMenu = menuItems . find ( menuItem => menuItem . module === u ) ; const isOpen = foucusMenu != null ? true : false ; return isOpen ; } }