The role of the SAP UI5 compatible version field and where the framework parses the value

When developing SAPUI5 applications, we can specify a SAPUI5 compatible version (SAPUI5 compatible version) field. This field is used to determine the SAPUI5 version used by the application to ensure that the application is compatible with the selected version of the framework.

The function of the SAPUI5 compatible version field is to specify the version of SAPUI5 that the application depends on. It defines the API and feature set used by the application at runtime. By specifying a compatible version, developers can ensure that applications run correctly on a specific SAPUI5 version and are able to take advantage of new features and improvements of that version.

Usually, the definition of the compatible version field can be found in the "index.html" file of the SAPUI5 application. Here is an example:

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta charset="utf-8">
    <title>My SAPUI5 Application</title>
    <script id="sap-ui-bootstrap" 
            src="resources/sap-ui-core.js"
            data-sap-ui-libs="sap.m"
            data-sap-ui-theme="sap_bluecrystal"
            data-sap-ui-compatVersion="1.78"
            data-sap-ui-resourceroots='{
     
     "my.app": "./"}'>
    </script>
</head>
<body class="sapUiBody">
    <div data-sap-ui-component
         data-name="my.app.Component"
         data-height="100%">
    </div>
</body>
</html>

In the above example, the compatible version field data-sap-ui-compatVersion is set to "1.78". This means that the application needs to run on SAPUI5 version 1.78 or higher.

When the application is loaded and started, the SAPUI5 framework will parse and load the corresponding version of the framework library and resources according to the specified compatible version field. The specific source code location depends on how the SAPUI5 library is deployed. The following are several common deployment methods and corresponding source code locations:

  • Local Deployment: If the SAPUI5 library is deployed locally, the source code location can be a relative path in the project folder. For example, you can put the folder structure of the SAPUI5 library together with the folder structure of the application, and then load the library file through a relative path.

  • CDN Deployment: If the SAPUI5 library is deployed via CDN (Content Delivery Network), then the source code location will be the URL provided by the CDN. For example, in the above example, the URL "resources/sap-ui-core.js" specified by the src attribute will be the CDN URL of the actual SAPUI5 library.

It should be noted that the resolution of the specific source code location is completed by the browser at runtime, and it will load the corresponding library files and resources according to the provided path or URL.

The following figure is the specific location where the SAP UI5 framework parses the value of the compatible version field:

insert image description here

Guess you like

Origin blog.csdn.net/i042416/article/details/130702699