当前位置:网站首页>Analysis of runtime instantiation of XML view root node in SAP ui5

Analysis of runtime instantiation of XML view root node in SAP ui5

2022-06-11 18:39:00 Hua Weiyun

Mission : analysis SAP UI5 root XML The view loading logic .


Put the mouse on initiator In this column , Find the name of the call stack UIComponent.js Of createContent Method :


You can see , Here's the logic , from manifest.json Parsing out root view Definition , Then instantiate the view .

Let's look at another root View loading failed SAP UI5 application :

Access to XMLHttpRequest at ‘https://sapui5.hana.ondemand.com/resources/sap/ui/demo/CombineLatest/Combine.view.xml’ from origin ‘http://localhost:3002’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Also successfully resolved root view The name of the :

Use ajax load xml view:

Correct path:

FALSE path:

hit :

See the application of the problem again :

We got a problem : Case mismatch .

This c Change to C after , The problem disappears :

XML Views provide special handling for context binding and style classes . Developers can use the XML Node to specify them . Please note that , These properties are not properties of individual controls , Therefore, it is not supported by the control constructor . When binding the content aggregation of this control , Binding template of bound content aggregation cannot have HTML Mark . An error will be thrown when the above combination is detected .

Application code should not call constructors directly , And should be used XMLView.create Or with XML Type of View.create factory . Factories provide more functionality than constructors ( Such as caching and preprocessing ) It also simplifies the asynchronous loading of views . Future functionality may only be available when using the plant .

Accept and define the initial attribute value 、 Aggregate and associate objects and object literals for event handlers mSettings.

This class does not have its own settings , But you can use the appropriate for the base type sap.ui.core.mvc.View All Settings .

原网站

版权声明
本文为[Hua Weiyun]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/162/202206111817467651.html