gpt4 book ai didi

javascript - 如何在SAPUI5中更改sap.m.Table的字体大小?

转载 作者:行者123 更新时间:2023-12-03 01:07:13 25 4
gpt4 key购买 nike

这是一个非常简单的 javascript 问题...但是我很挣扎,我尝试使该表中的字体变大,但我无法让它从 sytle.css 中获取样式。谁能解释一下为什么它不起作用以及完成此任务的最佳方法?我刚刚开始学习...非常感谢!

样式.CSS

.bigLabel {
font-size: 36px;

}

查看.XML

<mvc:View xmlns:html="http://www.w3.org/1999/xhtml" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m" xmlns:cd="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1" controllerName="zTESTJK1.zTESTJK1.controller.Main" displayBlock="true">
<App id="idAppControl">
<pages>
<Page title="{i18n>title}">
<content>
<List id="list0" items="{/PESListSet}" headerText="List">
<items>
<StandardListItem type="Navigation" title="{FinishCode1}" description="{Matnr}" icon="sap-icon://picture" id="item0"/>
</items>
</List>

<Table id="table0" items="{/PESListSet}" headerText="Web Paint Booth " class="bigLabel">
<items>
<ColumnListItem type="Active" id="item0_1536935024975" >
<cells>
<Label text="{FinishCode1}" id="text0" class="bigLabel"/>
<Text text="{Hqty}" id="text1"/>
<Text text=" { path: '/Htime/ms', type: 'sap.ui.model.type.Time', formatOptions: { source : { pattern : 'timestamp' }, pattern: 'HH:mm:ss' } }" id="text2"/>
<Text text="{Hpaint}" id="text3"/></cells>
</ColumnListItem>
</items>
<columns>
<Column id="column0">
<header>
<Label text="Finish" id="label0"/>
</header>
</Column>
<Column id="column1">
<header>
<Label text="Qty" id="label1"/>
</header>
</Column>
<Column id="column2">
<header>
<Label text="Time Hung" id="label2"/>
</header>
</Column>
<Column id="column3">
<header>
<Label text="Hand Paint" id="label3"/>
</header>
</Column>
</columns>
</Table>
</content>
</Page>
</pages>
</App>

最佳答案

首先,在 style.css 中添加 !important 来覆盖 ui5 样式:

.bigLabel {
font-size: 36px !important;
}

其次,直接添加到每个控件class="bigLabel"。每个直接包含应在 bigLabel 类的 font-size 中显示的文本的控件:

<Table 
id="table0"
items="{/PESListSet}"
headerText="Web Paint Booth">
<items>
<ColumnListItem
type="Active"
id="item0_1536935024975">
<cells>
<Label
text="{FinishCode1}"
id="text0"
class="bigLabel"/>
<Text
class="bigLabel"
text="{Hqty}"
id="text1"/>
<Text
class="bigLabel"
text="{
path: '/Htime/ms',
type: 'sap.ui.model.type.Time',
formatOptions: {
source: {
pattern: 'timestamp'
},
pattern: 'HH:mm:ss'
}
}"
id="text2"/>
<Text
class="bigLabel"
text="{Hpaint}"
id="text3"/>
</cells>
</ColumnListItem>
</items>
<columns>
<Column
id="column0">
<header>
<Label
class="bigLabel"
text="Finish"
id="label0"/>
</header>
</Column>
<Column
id="column1">
<header>
<Label
class="bigLabel"
text="Qty"
id="label1"/>
</header>
</Column>
<Column
id="column2">
<header>
<Label
class="bigLabel"
text="Time Hung"
id="label2"/>
</header>
</Column>
<Column
id="column3">
<header>
<Label
class="bigLabel"
text="Hand Paint"
id="label3"/>
</header>
</Column>
</columns>
</Table>

关于javascript - 如何在SAPUI5中更改sap.m.Table的字体大小?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52340994/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com