import {Component, OnInit, ViewChild} from '@angular/core'; @Component({ template: `
`, styleUrls: [] }) export class DemoTabTitleComponent implements OnInit { constructor() { } titleDatas; defaultTitle; @ViewChild('tabTitle') tabTitle; ngOnInit() { this.setTabTitleData(); } setTabTitleData() { this.titleDatas = [ { title: '工作量申请', value: 0 }, { title: '工作量待办', value: 1 }, { title: '工作量工单查询', value: 2 } ]; this.defaultTitle = this.titleDatas[2]; } tabTitleChangeEvent(ev) { console.log(ev); } // 重置标题 setTitle() { this.tabTitle.setTabTitle(this.titleDatas[0]); } }