HTML5開發移動web應用——SAP UI5篇(8)

來源:互聯網
上載者:User

標籤:

本次對之前學習的SAP UI5架構知識進行簡單小結,以及重點部分知識的梳理。

1、在UI5使用過程中,命名空間的概念很重要。

2、一般的sap組件引用格式如下:

sap.ui.define([   "sap/ui/core/UIComponent",   "sap/ui/model/json/JSONModel",   "sap/ui/model/resource/ResourceModel"], function (UIComponent, JSONModel, ResourceModel) 

define後每引用sap的一個組件,後面的function就要傳入一個對應的參數。

3、以下是component使用的基本架構:

sap.ui.define([   "sap/ui/core/UIComponent"], function (UIComponent) {   "use strict";   return UIComponent.extend("", {       init : function () {         // call the init function of the parent         UIComponent.prototype.init.apply(this, arguments);}   });});

Component的構建流程如上,extend UIComponent這個架構,裡面init為初始化函數,裡面可以設定其他屬性(包括配置模型等),如下:

sap.ui.define([   "sap/ui/core/UIComponent",   "sap/ui/model/json/JSONModel",   "sap/ui/model/resource/ResourceModel"], function (UIComponent, JSONModel, ResourceModel) {   "use strict";   return UIComponent.extend("sap.ui.demo.wt.Component", {            metadata : {rootView: "sap.ui.demo.wt.view.App"},      init : function () {         // call the init function of the parent         UIComponent.prototype.init.apply(this, arguments);         // set data model         var oData = {            recipient : {               name : "World"            }         };         var oModel = new JSONModel(oData);         this.setModel(oModel);          // set i18n model         var i18nModel = new ResourceModel({            bundleName : "sap.ui.demo.wt.i18n.i18n"         });         this.setModel(i18nModel, "i18n");      }   });});

4、注意manifest檔案在一個應用中的重要性,manifest.json是app的設定檔。

HTML5開發移動web應用——SAP UI5篇(8)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.