[英]Add Custom SAPUI5 Library to SAP Cloud Platform Fiori Launchpad (Portal Service)
我已經使用SAP Web IDE創建了一個自定義SAPUI5庫,並將該庫部署到SAP Cloud Platform。 該庫供多個SAPUI5應用程序使用,當從SAP Web IDE啟動應用程序時,該庫可以完美工作。 對庫的依賴關系在每個應用程序的manifest.json中定義:
"dependencies": {"libs": {"custom.library"}: {}}}
此外,我已經為文件neo-app.json添加了正確的路徑。
現在,我已將SAPUI5應用程序注冊到SAP Cloud Platform Fiori Launchpad。 我可以啟動啟動板並查看應用程序的磁貼。 但是,當我啟動一個應用程序時,會發生以下錯誤:錯誤:無法從https://sapui5.hana.ondemand.com/1.52.17/resources/custom/library/library加載“ custom / library / library.js” 。 js :404
如何將自定義UI5庫注冊到Fiori Launchpad?
在SAP Community上,您將找到有關SAPUI5自定義控件庫的博客 。 在那里,您需要為新部署的庫在neo-app.json文件的“ routes”數組中添加一個條目。 條目應如下所示:
{
"path": "/webapp/resources/my/custom/control",
"target": {
"type": "application",
"name": "mycustomlib",
"entryPath": "/"
},
"description": "Custom control library"
}
在這里,“路徑”是您在控制器JS文件的依賴項定義中使用的路徑。 “目標”子句中的“名稱”包含將庫部署到SAP Cloud Platform中的名稱。
正如SAP Fiori Crew指出的那樣,您需要在neo-app.json
為SAP Cloud Platform路由器創建一個路由條目,以從應用程序請求時知道從何處提供庫文件。
嘗試在啟動板中加載應用程序時,找出需要添加的確切URL的一個好方法是在瀏覽器的開發人員工具中檢查網絡請求:
在上面的示例中,將此條目添加到neo-app.json
解決了該問題:
{
"path": "/sap/ui5/1/resources/vplanner/common",
"target": {
"type": "application",
"name": "vpfioricommon"
},
"description": "Common Library"
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.