SAPUI5:: core:view 和 mvc:view 的区别 [英] SAPUI5:: Difference between core:view and mvc:view

查看:33
本文介绍了SAPUI5:: core:view 和 mvc:view 的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以简要解释一下或将我重定向到适当的链接以了解 SAPUI5/Fiori 应用程序的 XML 视图中 core:viewmvc:view 之间的区别?

Can someone explain in brief or re-direct me to appropriate link to understand the difference between core:view and mvc:view in XML view of SAPUI5/Fiori application?

当我们在 Eclipse 中启动应用程序并使用 sap.m 库创建 XML 视图时,我们看到 core:view,但在 SAPUI5 SDK - Demo Kit 中的示例应用程序中,我们看到 mvc:查看.请帮助我们了解何时使用什么.

When we start an application in Eclipse and create XML view using sap.m library we see core:view, but in sample applications in SAPUI5 SDK - Demo Kit, we are seeing mvc:view. Please help us understanding when to use what.

<core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
  controllerName="splitapptest.Master" xmlns:html="http://www.w3.org/1999/xhtml">
  <Page title="Title">
  <content>

  </content>
  </Page>
</core:View>

推荐答案

View 控件在 sap.ui.core.mvc 中:见 类 sap.ui.core.API 文档中的 mvc.View.因此,XML 视图定义中 View 元素的命名空间是 sap.ui.core.mvc.

The View control is in sap.ui.core.mvc: see Class sap.ui.core.mvc.View in the API documentation. Therefore, the namespace for a View element in an XML view definition is sap.ui.core.mvc.

这通常转化为:

<mvc:View xmlns:mvc="sap.ui.core.mvc"…>

当然前缀是任意的,你也可以:

but of course the prefix is arbitrary and you could just as well have:

<banana:View xmlns:banana="sap.ui.core.mvc"…>

关键是命名空间很重要,至少在技术上是这样.混淆可能是因为 XML 处理器对为根 View 元素指定的命名空间相当宽松.

The point is that it's the namespace that's important, at least technically. The confusion probably arises because the XML processor is rather lenient on the namespace specified for the root View element.

所以要具体回答你的问题,而 core:View 如果你疯狂地指定 xmlns:core="sap.ui.core.mvc" 可能是正确的",会很混乱,所以最好的表达方式是

So to answer your question specifically, while core:View might be "correct" if you crazily specified xmlns:core="sap.ui.core.mvc", it would be very confusing, so the best way to express it is

<mvc:View xmlns:mvc="sap.ui.core.mvc"…>

这篇关于SAPUI5:: core:view 和 mvc:view 的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆