如何禁用TabBarButton? 我希望它不可点燃和灰色。
指南中没有任何参数可供设置。 https://dojotoolkit.org/reference-guide/1.9/dojox/mobile/TabBarButton.html
createFooter : function() {
this.inherited(arguments);
this.footer = new Footer({}, this.footerNode);
this.settingsBtn = new TabBarButton(
{
clickable:false,
icon : "images/settingsIcon.png",
}, domConstruct.create("li"));
this.footer.addChild(this.settingsBtn);
this.settingsBtn.onClick = lang.hitch(this, "settings");
},
settings : function() {
alert("settings started");
}
答案 0 :(得分:1)
您可以将clickable设置为false。它是父_itembase中的参数。
您的文档链接可能已过期,您可以在_itembase源代码中找到此参数。
答案 1 :(得分:1)
我创建了自己的小部件,因为这不是tabbarButton的默认功能。 这是我的代码:
define([
"dojo/_base/declare",
"dojo/_base/lang",
"dojo/on",
"dojo/dom-class",
"dojox/mobile/TabBarButton"
], function(declare, lang, on, domClass, TabBarButton) {
return declare("TabBarButtonDisable",[TabBarButton], {
onClickBackup:null,
isDisabled : false,
_setIsDisabledAttr : function(isDisabled) {
this.isDisabled = isDisabled;
this.renderIsDisabled();
},
_getIsDisabledAttr : function() {
return this.isDisabled;
},
renderIsDisabled : function() {
if (this.isDisabled) {
domClass.add(this.domNode, "disabled");
this.onClick = function(){
// isDisabled
};
} else {
domClass.remove(this.domNode, "disabled");
this.onClick = this.onClickBackup;
}
},
buildRendering : function() {
this.inherited(arguments);
this.onClickBackup = this.onClick;
},
postCreate: function() {
this.inherited(arguments);
}
});
});