import template from "./TabPane.html"; class TabPane { props = { key: Number, tab: String }; state = { activeKey: null, key: this.props.key, }; watch = { tab: function (newVal, oldVal) { if (newVal !== oldVal) { let item = this.antdTabs.state.labels.find(function (item) { return item.key === this.props.key; }); if (item) { item.name = newVal; } } }, }; template = template; constructor(antdTabs) { this.antdTabs = antdTabs.getContext(); this.antdTabs.state.labels.push({ name: this.props.tab, key: this.props.key, }); this.antdTabs.state.childrens.push($scope); this.state.activeKey = this.antdTabs.state.activeKey; } }