Component reuse in manifest.json file

后端 未结 1 1991
逝去的感伤
逝去的感伤 2020-12-17 06:31

We are currently building a set of apps, where there is a lot of reuse.

Currently we got it working by using jQuery.sap.registerModulePath and jQuery.sap.require. Bu

相关标签:
1条回答
  • 2020-12-17 07:20

    Here is a working example with nested components: https://embed.plnkr.co/e7KS48/

    The descriptor attribute componentUsages is available since 1.47.0. Once defined, UI5 takes care of resolving the Component and its module path before rendering the owning ComponentContainer.

    ComponentContainer is needed because a Component cannot be placed into the UI without a container. In my example above, the Container is defined declaratively in Home.view.xml with the respective usage property.

    <core:ComponentContainer id="containerForChildComponent"
      autoPrefixId="true"
      settings="{id: 'childComponent'}"
      usage="reuseAnotherComponent"
      manifest="true"
      height="100%"
      async="true"
    />
    
    "sap.ui5": {
      "componentUsages": {
        "reuseAnotherComponent": {
          "name": "anotherComponent",
          "lazy": false
        }
      },
      "resourceRoots": {
        "anotherComponent": "./component_B"
      },
      // ...
    }
    

    As you can see, the resourceRoots can be also defined in the descriptor which could point to other component / app locations.


    Example for UI5 apps w/ version below 1.47: https://embed.plnkr.co/ytXZJ9

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