HTML5開發移動web應用——SAP UI5篇(9)
阿新 • • 發佈:2017-07-15
概念 之前 web spa width show 基本 space 宋體
這裏面利用了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"/> <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>
HTML5開發移動web應用——SAP UI5篇(9)