Kendo UI angular 2 TabStripComponent有一个方法selectTab。如何使用它从打字稿代码激活选项卡?
您可以使用 tabstrip 组件中的 selectTab(index( 方法。
首先,将选择器添加到视图组件中的选项卡栏:
<kendo-tabstrip #tabstrip>... </kendo-tabstrip>
现在,您可以通过以下方式从模块访问选项卡栏
@ViewChild('tabstrip') public tabstrip: TabStripComponent;
最后,您可以使用其索引激活任何选项卡
tabstrip.selectTab(index);
如果你想看一看,这里有一个 Plunker。
请注意,如果禁用目标选项卡,它将不会切换!
找不到如何使用selectTab
方法,但您可以使用selected
属性来决定哪个选项卡处于活动状态。如文档中所示
尝试
[selected]="i == selected"
或
selected value = true from ts end
那么你想要的那个标签将是 actvie
ex:selected=0;
第一个选项卡将处于活动状态