YUI3 - 修改标签

问题描述:

我正在试验YUI3TabView组件。使用此example,如何禁用其中一个选项卡(可能使用Tab对象)?我试图找到不同的例子,但only few that I found只显示如何实际创建标签。YUI3 - 修改标签

UPDATE:

我试过如下:

tabview.item(1).disable(); 

但标签仍然是可以点击的,虽然类“衣,标签禁用”添加到李保持在正常状态-元件。

更新2:

我设法通过禁止使用下面的代码的第二个选项卡:

tabview.item(1) 
    .disable() 
    .on('selectedChange', function() { 
     return false; 
    }); 

现在的问题是:如何再次启用该选项卡?

解决!为了使禁用和启用字段的工作,一个必须包括TabView声明之后下面的代码片断:

tabview.on('tab:click', function (e) { 
    // Prevent the browser from navigating to the URL specified by the 
    // anchor's href attribute. 
    if (e.target.get('disabled')) { 
     e.preventDefault(); 
     e.domEvent.preventDefault(); 
    } 
}); 

完整的例子可以被看作here