我需要在我的应用程序中使用Here Maps Javascript API库。当我独立运行应用程序时它运行良好(因为我将它包含在index.html中)。但是,当我将其部署在HANA Cloud Platform上并尝试在HCP Portal站点内运行时,它会失败。 我知道我需要加载库文件Component.js因为没有使用index.html。我的问题是,在开始绘制地图之前,我需要加载4个不同的js文件和一个样式表。我正在使用jQuery.sap.includeScript()
和jQuery.sap.includeStyleSheet()
函数来执行此操作,但在加载库文件(请参阅chrome中的“网络”选项卡上的状态为“挂起”)之前调用rootview的onInit和onAfterRendering()。在SAPUI5中加载第三方库
我跟着后下:
UsingjQuery.sap.includeScript().then() in HCP Firori Launchpad
我如何可以加载/初始化库文件被加载后,才视图。
在component.js中完成所有这些操作是否正确? manifest.json在实现这个过程中扮演什么角色。
任何示例都会有所帮助。 在此先感谢。
我的组件初始化代码如下:
init: function() {
// call the base component's init function
UIComponent.prototype.init.apply(this, arguments);
var that = this;
//Load the here maps library
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-core.js", "hereMapsCore", $.proxy(function(succ) {
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-service.js", "hereMapsService", $.proxy(function(succ) {
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-ui.js", "hereMapsUi", $.proxy(function(succ) {
jQuery.sap.includeScript("https://js.api.here.com/v3/3.0/mapsjs-mapevents.js", "heremapsEvent", $.proxy(function(succ) {
jQuery.sap.includeStyleSheet("https://js.api.here.com/v3/3.0/mapsjs-ui.css", "hereMapscss", $.proxy(function() {
// UIComponent.prototype.init.apply(this, arguments);
// set the device model
this.setModel(models.createDeviceModel(), "device");
var a = this;
}, this));
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}, this), function(oErr) {
MessageBox.alert("Map File not loaded");
});
}