import { Component , OnInit , Input , Output , EventEmitter } from '@angular/core' ; import * as _ from 'lodash' ; import { ActivatedRoute , Route } from '@angular/router' ; import { Subscription } from 'rxjs' ; @ Component ( { selector : 'app-comp-page-list' , templateUrl : './comp-page-list.component.html' , styleUrls : [ './comp-page-list.component.scss' ] } ) export class CompPageListComp implements OnInit { @ Input ( ) pages ; @ Output ( ) selCurrentPage = new EventEmitter < any > ( ) ; @ Output ( ) delCurrentPage = new EventEmitter < any > ( ) ; @ Output ( ) editorCurrentPage = new EventEmitter < any > ( ) ; options = { } ; pageList : any [ ] ; pageId : string ; constructor ( private activeRoute ) { } ngOnInit ( ) { } initPageState ( currentPage ? ) { if ( this . pages && Array . isArray ( this . pages ) ) { _ . map ( this . pages , page => { page [ 'actived' ] = false ; } ) ; } } changeComponent ( item ) { this . initPageState ( item ) ; item [ 'actived' ] = true ; this . selCurrentPage . emit ( item ) ; } deletePage ( page , event ) { this . delCurrentPage . emit ( page ) ; event . stopPropagation ( ) ; } editorPage ( page , event ) { this . editorCurrentPage . emit ( page ) ; event . stopPropagation ( ) ; } }