我的应用中有两个 FLP 磁贴。一个可以访问sap.ui.core.Fragment.load,但另一个不能。
他们都通过
<script
id="sap-ui-bootstrap"
src="https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
data-sap-ui-theme="sap_belize_plus"
data-sap-ui-libs="sap.m, sap.ushell, sap.collaboration"
data-sap-ui-preload="async"
data-sap-ui-compatVersion="edge"
data-sap-ui-frameOptions='allow'
data-sap-ui-resourceroots='{
"monitor": "./",
"common": "./../../../common"
}'>
</script>
Run Code Online (Sandbox Code Playgroud)
Fragment.jsSAPUI5 资源中没有不工作的资源,但我可以访问Fragment-dbg.js
我也对比过manifest.json,没有区别。有没有其他线索?
I found that after sap.ui.xmlfragment(), Fragment.load() exists.
So add it to sap.ui.define or .require, then it works.
sap.ui.require([
"sap/ui/core/Fragment"
], function(Fragment){
Fragment.load({
name: "namespace.myFragment",
controller: this
}).then(function(oFragment) {
// ...
}.bind(this));
}.bind(this));
Run Code Online (Sandbox Code Playgroud)
Thanks to @Boghyon Hoffmann:
the factory functions inside the
sap.ui.*namespace have also been refactored. UI5 now provide fully asynchronous APIs on top. The old APIs are of course still available for compatibility reasons, but are also deprecated. Modularization of the SAPUI5 Core
New API must use modular way, which means use sap.ui.require / sap.ui.define.
Documentation: Legacy Factories Replacement
| 归档时间: |
|
| 查看次数: |
3205 次 |
| 最近记录: |