首页前端开发HTMLHTML5开发移动web应用――SAP UI5篇(9)

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

时间2024-01-26 17:58:02发布访客分类HTML浏览697
导读:收集整理的这篇文章主要介绍了html5教程-HTML5开发移动web应用――SAP UI5篇(9 ,觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。...
收集整理的这篇文章主要介绍了html5教程-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">
    /button>
input value="{
/recipient/name}
" description="Hello {
/recipient/name}
    " valueliveupdate="true" width="60%" data-cke-editable="1" contenteditable="false">
button text="{
    i18n>
showHelloButtonText}
    " PRess="onShowHello">
    /button>
    /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>
    
… 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> 这里面利用了SAP UI5中的Shell组件,把页面内容放在这里面可以保证页面的响应式,更好地支持移动端设备。除此之外,我们还设定了height属性为100%,表示沾满整个屏幕。

之前我们对于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">
    /button>
input value="{
/recipient/name}
" description="Hello {
/recipient/name}
    " valueliveupdate="true" width="60%" data-cke-editable="1" contenteditable="false">
button text="{
    i18n>
showHelloButtonText}
    " press="onShowHello">
    /button>
    /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>
    
… 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> 这里面利用了SAP UI5中的Shell组件,把页面内容放在这里面可以保证页面的响应式,更好地支持移动端设备。除此之外,我们还设定了height属性为100%,表示沾满整个屏幕。

觉得可用,就经常来吧! 欢迎评论哦! html5教程,巧夺天工,精雕玉琢。小宝典献丑了!

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!

ClassdivHTMLpost-format-gallery

若转载请注明出处: HTML5开发移动web应用――SAP UI5篇(9)
本文地址: https://pptw.com/jishu/587090.html
HTML5移动开发实战必备知识――本地存储(1) HTML 5 Web 存储――localStorage

游客 回复需填写必要信息