HTML5开发移动web应用——SAP UI5篇(8)
2017-07-24 20:36
585 查看
本次对之前学习的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篇(1)
- HTML5开发移动web应用——SAP UI5篇(4)
- HTML5开发移动web应用——SAP UI5篇(6)
- HTML5开发移动web应用——SAP UI5篇(2)
- HTML5开发移动web应用——SAP UI5篇(9)
- HTML5开发移动web应用——SAP UI5篇(5)
- HTML5开发移动web应用——SAP UI5篇(8)
- HTML5开发移动web应用——SAP UI5篇(3)
- HTML5开发移动web应用——SAP UI5篇(7)
- HTML5开发移动web应用——SAP UI5篇(6)
- HTML5开发移动web应用——SAP UI5篇(7)
- HTML5开发移动web应用——SAP UI5篇(9)
- HTML5开发移动web应用—JQuery Mobile(1)
- HTML5开发移动web应用——Sencha Touch篇(10)
- HTML5开发移动web应用——Sencha Touch篇(4)
- HTML5,缔造Web移动应用开发的未来
- HTML5开发移动web应用——Sencha Touch篇(9)
- 移动Web应用程序开发 HTML5篇 (一) HTML5简介
- HTML5开发移动web应用——Sencha Touch篇(7)
- HTML5开发移动web应用——Sencha Touch篇(10)