头图

Jerry's previous article How to integrate third-party libraries in SAP UI5 applications: A small trick to view web applications and print debugging information on mobile devices introduces a technique for SAP UI5 to define and use third-party libraries.

Later, in my technical exchange group, SAP expert Guo Ye reported that there is another way to define dependencies in the SAP UI5 manifest.json file.



This article introduces the second method. In the SAP UI5 project, create a lib folder, put the third-party library file into it, and then define the reference of the third-party library file in the sap.ui5 area of the manifest.json file.

Source code:

"resources":{
        "js": [ {
                "uri": "lib/vconsole-min.js",
                "name": "vconsole-min.js",
                "version": "3.7.0"
            }]
    }

When running, the vConsole library is successfully loaded.

Of course, manually using the following statements to load third-party libraries in the SAP UI5 controller can also work:

jQuery.sap.require("SAPUI5ExternalLibs/libs/moment");

The third-party library loaded in this way in this article is a greedy loading method, that is, when the SAP UI5 application is initialized, the third-party library will be loaded. And Jerry's previous article How to integrate third-party libraries in SAP UI5 applications: a small trick to view the debugging information of Web applications on mobile devices is lazy loading, that is, only the third-party library functions are actually used When the controller and the corresponding view of the controller are used by the user, the loading of the third-party library is actually triggered.

More original articles by Jerry, all in: "Wang Zixi":


注销
1k 声望1.6k 粉丝

invalid