Step 14: Custom CSS and Theme Colors 自定义CSS类

一、练习

新建文件夹14,复制练习文件夹下内容Step 12: Shell Control as Container && Step 13:Margins and Paddings 使用CSS类对页面美化-

1.1 新建style.css

首先在webapp下新建css文件夹,再在css文件下新建style.css文件

css 复制代码
html .myAppDemoWT .myCustomButton.sapMBtn {
  margin-right: 10px;
  margin-left: 0.125rem;
  color: rgb(18, 92, 239);
}

.myAppDemoWT .myCustomText {
  display: inline-block;
  font-weight: bold;
  color: rgb(18, 92, 239);
}

2.2manifest.json新增配置

"sap.ui5" 新增css配置如下

css 复制代码
 "resources": {
      "css": [
        {
          "uri": "css/style.css"
        }
      ]
    }

2.3 App.view.xml

XML 复制代码
<mvc:View
   controllerName="sap.ui5.walkthrough.controller.App"
	xmlns="sap.m"
	xmlns:mvc="sap.ui.core.mvc" 
   displayBlock="true">
 <Shell>
      <App class="myAppDemoWT">
         <pages>
            <Page title="{i18n>homePageTitle}">
               <content>
                  <Panel
                     headerText="{i18n>panelTitle1}">
                     <content>
                        <Button
                        text="{i18n>ButtonText}"
                        press="onPress"
                        class="myCustomButton"/>
                        <Input 
                        id="input2"
                        value="{/recipient/name}"
                        valueLiveUpdate="true"
                        width="60%"/>
                        <Text
                        text="{i18n>textDesc} {/recipient/name}"                       
                        class="sapUiSmallMargin myCustomText"/>
                     </content>
                  </Panel>
               </content>
            </Page>
         </pages>
      </App>
   </Shell>
</mvc:View>

与Step12相比,

  • App标签新增class="myAppDemoWT"
  • Button类替换class="myCustomButton"
  • Text标签类替换class="sapUiSmallMargin myCustomText"

2.4 运行结果

相关推荐
x-cmd几秒前
[x-cmd] jsoup 1.22.1 版本发布,引入 re2j 引擎,让 HTML 解析更安全高效
前端·安全·html·x-cmd·jsoup
天下代码客17 分钟前
使用electronc框架调用dll动态链接库流程和避坑
前端·javascript·vue.js·electron·node.js
weixin1997010801641 分钟前
【性能提升300%】仿1688首页的Webpack优化全记录
前端·webpack·node.js
冰暮流星1 小时前
javascript之数组
java·前端·javascript
晚霞的不甘1 小时前
Flutter for OpenHarmony天气卡片应用:用枚举与动画打造沉浸式多城市天气浏览体验
前端·flutter·云原生·前端框架
xkxnq2 小时前
第五阶段:Vue3核心深度深挖(第74天)(Vue3计算属性进阶)
前端·javascript·vue.js
三小河2 小时前
Agent Skill与Rules的区别——以Cursor为例
前端·javascript·后端
Hilaku2 小时前
不要在简历上写精通 Vue3?来自面试官的真实劝退
前端·javascript·vue.js
三小河2 小时前
前端视角详解 Agent Skill
前端·javascript·后端
Aniugel2 小时前
单点登录(SSO)系统
前端