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 运行结果

相关推荐
光影少年8 分钟前
next.js与纯react区别
前端·javascript·react.js
派大鑫wink10 分钟前
【Day31】Web 开发入门:HTTP 协议详解(请求 / 响应、状态码、请求头)
前端·网络协议·http
2501_9447114313 分钟前
理解 React 自定义 Hook:不只是“封装”,更是思维方式的转变
前端·javascript·react.js
紫小米18 分钟前
Function calling实践
java·前端·数据库
豌豆学姐21 分钟前
Sora2 的使用与 API 获取调用实践(附开源前端和接入示例)
前端·开源
林恒smileZAZ22 分钟前
前端 HTML 转 PDF
前端·pdf·html
xiaoxue..28 分钟前
Zustand 状态管理:轻量高效的 React 状态解决方案✨
前端·react.js·面试·状态模式·zustand
lkbhua莱克瓦2430 分钟前
Web前端开发核心认知与技术演进
开发语言·前端·笔记·javaweb
PieroPc31 分钟前
Html+css+js 写一个销售单据数据收集工具,会用到小米相机文档功能、NasCab、豆包Ai作为辅助
javascript·css·html
开开心心_Every33 分钟前
免费视频画质增强:智能超分辨率无损放大
java·服务器·前端·python·学习·edge·powerpoint