openui5 js 视图 addStyleClass [英] openui5 js view addStyleClass
问题描述
我们如何使用 mSetting 设置类?
How can we set class with mSetting?
例如:
new sap.m.Button({}).addStyleClass("my-class"); //work
另一种方式?
new sap.m.Button({
styleClass: "my-class" // did'n work
});
有没有可能这样设置类?
Any possibility to set class that way?
推荐答案
截至目前(直到版本 SAPUI5 1.28.4),styleClass 不是 sap.m 支持的属性.按钮
及其基本类型的( sap.ui.core.Control
) 属性.因此,您必须直接在 XML 视图中使用 addStyleClass(sStyleClass)
OR.
As of now (till version SAPUI5 1.28.4), styleClass is not a supported property of sap.m.Button
nor its base type's( sap.ui.core.Control
) property.
Hence you have to use addStyleClass(sStyleClass)
OR in XML view directly.
正如@Ivan 所说,您可以使用 busy
属性,因为它存在于基本类型 sap.ui.core.Control
As @Ivan said, you can use busy
property because this exists in the base type sap.ui.core.Control
希望我们能在更高版本中实现这一基本功能.
Hopefully we will this basic functionality in higher releases.
更新:针对多个 CSS 类
Update: for multiple CSS classes
var oLabel = new sap.m.Label({text:"Sample"}).addStyleClass("sample1 sample2");
或
var oLabel = new sap.m.Label({text:"Sample"}).addStyleClass("sample1").addStyleClass("sample2");
这篇关于openui5 js 视图 addStyleClass的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!