openui5 js view addStyleClass

前端 未结 1 890
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-03 00:21

How can we set class with mSetting?

For example:

new sap.m.Button({}).addStyleClass(\"my-class\"); //work

Another way?



        
1条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-03 00:43

    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.

    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.

    Update: for multiple CSS classes

    var oLabel =  new sap.m.Label({text:"Sample"}).addStyleClass("sample1 sample2");
    

    OR

    var oLabel =  new sap.m.Label({text:"Sample"}).addStyleClass("sample1").addStyleClass("sample2");
    

    0 讨论(0)
提交回复
热议问题