问题描述
遵循 openui5 教程,但有一些偏差,当我收到以下警告时我提供应用的开发版本:
Following the openui5 tutorial with some deviations I get the following warning when I serve the dev version of the app:
不要为控制器使用同步控制器创建'sap.ui.demo.walkthrough.controller.HelloPanel'!使用新的异步工厂 'sap.ui.core.mvc.Controller.create(...)' 代替.
在 webapp/view/App.view.xml 中,HelloPanel 视图在教程中被引用,即:
In webapp/view/App.view.xml the HelloPanel view is referenced as in the tutorial, that is with:
如果我提供使用 "npm run build:ui" 生成的生产版本我没有看到这个警告.如果我将代码更改为从 CDN 启动,我也看不到它.
If I serve the production build generated with "npm run build:ui" I don't see this warning. If I change the code to boot from the CDN, I also do not see it.
我已将本地 UI5 安装更新为与 CDN 中相同的版本(现在为 1.80),但这没有帮助.
I have updated the local UI5 installation to the same version as in the CDN (now 1.80) but that didn't help.
这个警告的原因是什么?还有,我应该担心吗?
What is the reason for this warning? Also, is it something I should worry about?
推荐答案
构造函数被上面的 mvc:XMLView 行隐式调用.
The constructor is implicitly called by the mvc:XMLView line above.
类 sap.ui.core.mvc.XMLView 没有自己的设置,但是来自基类 sap.ui.core.mvc.View 的所有设置都可以与构造函数一起使用.
Class sap.ui.core.mvc.XMLView does not have its own settings but all those from the base class sap.ui.core.mvc.View may be used with the constructor.
其中包括异步" 并将其设置为true";删除警告,如下所示:
Among them is "async" and setting it "true" removes the warning, like this:
<mvc:XMLView
viewName="sap.ui.demo.walkthrough.view.HelloPanel"
async="true"
/>
这篇关于警告使用新的异步工厂“sap.ui.core.mvc.Controller.create(...)"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!