Opportunity的s3在init的时候有加载custom css的文件
jQuery.sap.includeStyleSheet(jQuery.sap.getModulePath("cus.crm.opportunity.css.Opportunity", ".css"), "sap-ui-theme-sap.crm");
我往这个css文件里面加一个自定义的css class
.myAwesomeBtnBackgroundColor {
background-color: red;
}
之后就找出Target button然后将这个custom css class加载上去…
var oFooter = this.getView().getController().getPage().getFooter(),
oFollowBtn = oFooter.getContentRight()[1];
oFollowBtn.addStyleClass("myAwesomeBtnBackgroundColor");
我们遇到的问题是改button text的颜色,比如把你们例子中的“follow me”字体改成蓝色。 你们email中的核心思想是找到button然后通过addStyleClass() 来修改button的css
如果我的理解没有错误的话,我已经尝试过了,但是其实修改button的css style并不能改变button text的style。
我有一个button,id是”interactionButton”它的text是“0 Requests”,我要根据不同的情况还改变 button text的颜色。
看我截图黄色highlight部分,目前我们发现只有改” interactionButton-inner”或者“interactionButton-content”的css style才能改text 的颜色,改动button “interactionButton”是不work的
曾经尝试在controller.js 的onAfterRendering方法里面通过拿到this.getView().byId(“interactionButton-inner”)或者this.getView().byId(“interactionButton-content”)来change style, 但其实在onAfterRendering方法里面,interactionButton-inner和interactionButton-content 都还没有被render,所以尝试失败
目前我们一个非常ugly的solution如下,直接修改div。。我觉得这样不是个good solution。。。。
首先看为什么byId, 传button id进去能够访问到button:
因此这里有两个维度的东西:
但是这个native html tag并不会注册到core的this.mElements去,因此byId() query不出来。
所以再回到你的需求,button的inner div这个实现对于我们application developer是透明的。如果我们要修改text color, 只能通过button 提供的API。
但是API 文档上button只有setText的功能,那我们先看看setText 是怎么被框架实现的?
通过读代码发现和你的实现一致。
因此我们可以得出一个generic的结论:
2. 否则,是native layer的属性,只用通过操作dom 解决。