当前位置:网站首页>SAP UI5 里 XML 视图根节点运行时实例化的分析
SAP UI5 里 XML 视图根节点运行时实例化的分析
2022-06-11 18:18:00 【华为云】
任务:分析 SAP UI5 root XML 视图的加载逻辑。

鼠标放到 initiator 这一列上,找到调用栈的 UIComponent.js 的 createContent 方法:

可以看到,这里的逻辑是,从 manifest.json 里解析出 root view 定义,然后实例化该视图。



我们再来看看另一个 root 视图加载失败的 SAP UI5 应用:

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.
也成功解析出 root view 的名称了:

使用 ajax 加载 xml view:


正确的 path:

错误的 path:

命中:
再看出问题的应用:
找到问题了:大小写不匹配。
这个 c 改成 C 后,问题消失:
XML 视图为上下文绑定和样式类提供了特殊处理。开发人员可以通过控件的 XML 节点上的绑定和类属性来指定它们。请注意,这些属性不是各个控件的属性,因此不受控件构造函数的支持。当绑定该控件的内容聚合时,绑定的内容聚合的绑定模板中不允许有 HTML 标记。检测到上述组合时会抛出错误。
应用程序代码不应直接调用构造函数,而应使用 XMLView.create 或带有 XML 类型的 View.create 工厂。 工厂提供了比构造函数更多的功能(例如缓存和预处理)并简化了视图的异步加载。 未来的功能可能仅在使用工厂时可用。
接受定义初始属性值、聚合和关联对象以及事件处理程序的对象文字 mSettings。
此类没有自己的设置,但可以使用适用于基类型 sap.ui.core.mvc.View 的所有设置。
边栏推荐
- Quanzhi Technology T3 Development Board (4 Core ARM Cortex - A7) - mqtt Communication Protocol case
- labelme进行图片数据标注
- [C语言]用结构体把输入的指定分数范围内的学生输出
- Map and set
- Ubuntu installs PSQL and runs related commands
- Common interview questions of network and concurrent programming
- [c language] shift elements after sorting elements of an array
- [c language] limit the number of searches and output the maximum value found in the number of internal searches
- 5分钟了解攻防演练中的红蓝紫
- v-for循环遍历
猜你喜欢

炫酷的可视化工具:processing 初识

Niu Ke's questions -- binary search tree and bidirectional linked list

The nearest common ancestor of binary tree

NR LDPC 打孔-punctured
MySQL/Redis 常见面试题汇总

力扣刷题——二叉树的层序遍历

On the sequence traversal of binary tree

Niu Ke swipes the question -- converting a string to an integer
![[C语言]压缩字符串并添加标记字符](/img/b7/f7918f3ee0c409faffc70addd5ee65.png)
[C语言]压缩字符串并添加标记字符

牛客刷题——合法括号序列判断
随机推荐
牛客刷题——合法括号序列判断
Summary of common mysql/redis interview questions
Introduction to basic use and pit closure of BigDecimal
Signal processing and capture
Niu Ke's questions -- two sorting methods
LDAP 目录服务器的现代化应用
排序的循环链表
非递归实现二叉树的前、中、后序遍历
最长严格递增子序列
使用mysql判断日期是星期几
PIL-Pillow图像处理【1】-安装与新建
Niuke brush questions part7
ISCSI详解(四)——ISCSI服务端配置实战
MMA-Self-defining function
系统的可扩展型
On the sequence traversal of binary tree
论高可用架构
ubuntu 安装psql以及运行相关命令
Ubuntu installs PSQL and runs related commands
EasyCwmp源码分析