HTML5开发移动web应用――SAP UI5篇(8)
导读:收集整理的这篇文章主要介绍了html5教程-HTML5开发移动web应用――SAP UI5篇(8 ,觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。...
收集整理的这篇文章主要介绍了html5教程-HTML5开发移动web应用――SAP UI5篇(8),觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。 本次对之前学习的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的构建流程如上,extendUIComponent这个框架,里面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的配置文件。
本次对之前学习的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的构建流程如上,extendUIComponent这个框架,里面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教程,巧夺天工,精雕玉琢。小宝典献丑了!
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: HTML5开发移动web应用――SAP UI5篇(8)
本文地址: https://pptw.com/jishu/587093.html