• HTML5开发移动web应用——SAP UI5篇(9)


    之前我们对于app的构建都是基于显示的。如今我们来格式化一下,引入很多其它的SAP UI5组件概念。这使得APP的一个界面更有层次性。更像是一个手机应用的界面,而且更好地使用SAP UI5中提供的功能。每一个不同的层次都有不同的功能。

    首先改动App.view.xml文件代码:

    <mvc:View
       controllerName="sap.ui.demo.wt.controller.App"
       xmlns="sap.m"
       xmlns:mvc="sap.ui.core.mvc"
      displayBlock="true">
       <App>
          <pages>
             <Page title="{i18n>homePageTitle}">
                <content>
                   <Panel
                      headerText="{i18n>helloPanelTitle}">
                      <content>
    
                         <Button
                            text="{i18n>showHelloButtonText}"
                            press="onShowHello"/>
                         <Input
                            value="{/recipient/name}"
                            description="Hello {/recipient/name}"
                            valueLiveUpdate="true"
                            width="60%"/>
                      </content>
                   </Panel>
                </content>
             </Page>
          </pages>
       </App>
    </mvc:View>
    跟之前的相比,尽管内容同样,可是我们引入了非常多组件。让这个界面更有了层次性。

    把全部的组件都放到了Page中,基本结构是App->Page(里面有content)->Panel(里面有content)。真正的页面内容都放在Panel中,前两层仅仅是为了实现基础功能。另外displayBlock设置为true,这样才干让手机页面正常显示。

      在index.html文件里改动代码例如以下:

    <!DOCTYPE html><html>
       <head>
          …
          <script>
             sap.ui.getCore().attachInit(function () {
                new sap.m.Shell({
                   app : new sap.ui.core.ComponentContainer({
                      name : "sap.ui.demo.wt",
                      height : "100%"
                   })
                }).placeAt("content");
             });
          </script>
       </head>
       <body class="sapUiBody" id="content">
       </body></html>
       这里面利用了SAP UI5中的Shell组件,把页面内容放在这里面能够保证页面的响应式。更好地支持移动端设备。除此之外。我们还设定了height属性为100%。表示沾满整个屏幕。






  • 相关阅读:
    制作一个漂亮的表格
    模版语言
    Django 学习
    linux系统服务名称
    CentOS下netstat + awk 查看tcp的网络连接状态
    Python的MySQLdb模块安装
    shellinabox安装
    堡垒机 paramiko 自动登陆代码
    堡垒机 paramiko代码
    Paramiko 模块使用
  • 原文地址:https://www.cnblogs.com/zhchoutai/p/7183429.html
Copyright © 2020-2023  润新知