import { Component, ViewChild, AfterViewInit } from '@angular/core'; import { FarrisTabsComponent } from '@farris/ui-tabs'; @Component({ selector: 'test-tabs', templateUrl: './testtab.component.html' }) export class TestTabsComponent implements AfterViewInit { @ViewChild('tabs1') tabs1: FarrisTabsComponent; tabs: any; tab1Show = true; position = 'top'; // @ViewChild('tabs') tabs: pageTabs = [ { id: 'a', disabled: false, title: '标签一', content: '标签一内容' }, { id: 'b', disabled: false, title: '标签二', }, { id: 'c', disabled: false, title: '标签三', }, { id: 'd', disabled: false, title: '标签四', content: 'sadas' }, { id: 'e', disabled: false, title: '标签五', } ]; constructor() { } ngAfterViewInit() { this.tabs = this.tabs1; } tabChange(e) { console.log(e); } tabRemove(e) { console.log(e); } addTabs(tabs) { const tabArr = [ { id: 'ss', title: '添加标签', removeable: true, }, { id: 'aa', title: '添加标签1', }, ]; this.tabs.addTabs(tabArr, 1, 'a'); } closeTab(tabs) { tabs.closeTab('d'); } show() { this.tab1Show = !this.tab1Show; } toTop() { this.position = 'top'; } toBottom() { this.position = 'bottom'; } toLeft() { this.position = 'left'; } toRight() { this.position = 'right'; } changeTab(pageTabs) { // this.tabs.tabs = []; this.pageTabs = pageTabs; } }