HTML5 mobile web Application Development-SAP UI5 (8)
This section briefly summarizes the previous SAP UI5 framework knowledge and summarizes the key knowledge.
1. The namespace concept is very important during the use of UI5.
2. The general sap component reference format is as follows:
sap.ui.define([ "sap/ui/core/UIComponent", "sap/ui/model/json/JSONModel", "sap/ui/model/resource/ResourceModel"], function (UIComponent, JSONModel, ResourceModel)
After define, each time a component of sap is referenced, a corresponding parameter is required for the subsequent function.
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.prototype.init.apply(this, arguments);} });});
The building process of Component is as follows: extendUIComponent framework, where init is the initialization function, and other attributes (including the configuration model) can be set in it, 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. Pay attention to the importance of the manifest file in an application. manifest. json is the configuration file of the app.