我需要改变刻度的颜色上UI5复选框。我已经看过了CSS,并发现这是在::before
选择:
我在CSS文件中添加了一个类的复选框,称为.accept
和定义如下:
.accept.sapMCbBg.sapMCbMarkChecked::before{
content: "\e05b";
font-family: "SAP-icons";
color: #00a600;
}
这是行不通的。你有什么建议吗?谢谢。
编辑:下面是复选框的代码:
var oCheckBox = new sap.m.CheckBox({
text: "test",
selected: false,
select: function(oEvent){
if (oEvent.getSource().getSelected() == true){
oEvent.getSource().addStyleClass("accept");
}else{
oEvent.getSource().removeStyleClass("accept");
}
}
});
嗯,有一些预定义的组复选框在UI5其中作为显示颜色基于ValueState
改变中给出。
输出: -
码-
// create CheckBoxes in different states
var oLayout = new sap.ui.commons.layout.MatrixLayout("matrix1");
oLayout.setLayoutFixed(false);
oLayout.setColumns(4);
var oCB1 = new sap.ui.commons.CheckBox({
text : 'error',
tooltip : 'Select for Error',
valueState : sap.ui.core.ValueState.Error
});
var oCB2 = new sap.ui.commons.CheckBox({
text : 'warning',
tooltip : 'Select for Warning',
valueState : sap.ui.core.ValueState.Warning
});
var oCB3 = new sap.ui.commons.CheckBox({
text : 'ReadOnly',
tooltip : 'This CheckBox is read only',
editable : false,
checked : true
});
var oCB4 = new sap.ui.commons.CheckBox({
text : 'disabled',
tooltip : 'This CheckBox is disabled',
enabled : false
});
oLayout.createRow(oCB1, oCB2, oCB3, oCB4);
// attach it to some element in the page
oLayout.placeAt("sample2");
值状态的选项 - https://openui5.hana.ondemand.com/#/api/sap.ui.core.ValueState
希望这将帮助你:)