如何以编程方式激活剑道 UI 角度 2 中的选项卡



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; 

第一个选项卡将处于活动状态

最新更新