This paper briefly summarizes the knowledge of SAP UI5 framework before learning, and combs the key parts of knowledge.
1, in the UI5 use process, the concept of the namespace is very important.
2, the General SAP component reference format is as follows:
Sap.ui.define ([ "Sap/ui/core/uicomponent", "Sap/ui/model/json/jsonmodel",
after define each reference to a component of SAP, the function behind it will pass in a corresponding parameter.
3. The following is the basic framework used by 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.proto Type.init.apply (this, arguments);});} );
Component construction process, such asextend UIComponent This framework, inside init is the initialization function, which can set other properties (including configuration model, etc.), as follows:
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, note the importance of manifest file in an application, Manifest.json is the app 's configuration file.
HTML5 developing mobile Web Applications--sap UI5 (8)