Adding a custom library as a dependency in SAP Fiori

后端 未结 1 1206
花落未央
花落未央 2020-12-13 22:36

I have a custom library com.foo.library I would like to include as a dependency of a Fiori-like app I have built.

SAP Fiori Launchpad for Developers -> Best Practice

相关标签:
1条回答
  • In your Fiori App:

    1. Put your dependencie into the app descriptor (manifest.json) (or if no app descriptor used into the config inside the Component.js)

      dependencies: {
          libs: ["sap.m", "sap.ui.layout", "com.foo.library"],
          components: [com.foo.component]
      }
      
    2. Let sap.ui.core know where to search for the namespace of your library.(Top of your Component.js)

      jQuery.sap.registerModulePath("com.foo", "/Path/on/the/server/");
      

    And now you can use your dependencies. And here is why:

    Before a module is loaded, the longest registered prefix of its module name is searched for and the associated URL prefix is used as a prefix for the request URL. The remainder of the module name is attached to the request URL by replacing dots ('.') with slashes ('/').

    The registration and search operates on full name segments only.

    Source: SAP UI5 API Documentation

    0 讨论(0)
提交回复
热议问题