import { Component, OnInit, AfterViewInit } from "@angular/core";
import { Location } from '@angular/common';

@Component({
  selector: "app-page-config",
  templateUrl: "./page-config.component.html",
  styleUrls: ["./page-config.component.less"],
})
export class PageConfigComponent implements OnInit, AfterViewInit {
  constructor(
    private _location: Location,
  ){}

  // tab
  tagList:any = [
    // { id: 1, name: '标本',},
  ];

  ngOnInit(): void {}

  ngAfterViewInit(){
    setTimeout(() => {
      let menus = JSON.parse(localStorage.getItem("menu"));
      let pageConfig = menus.find(item => item.link == 'pageConfig');
      this.tagList = pageConfig ? (pageConfig.childrens || []) : [];
      this.tagList.length && this.clickTag(this.tagList[0]);
    }, 0)
  }

  // 点击tab
  activeTagLink:any = 1;
  clickTag(tag){
    this.activeTagLink = tag.link;
  }

  // 返回
  goBack(){
    this._location.back();
  }
}
