当我试图从" view“文件夹加载一个视图时,我得到了错误"resource view/View1.view.xml load not be load from resources/view/View1.view.xml”。WebIDE中的文件夹结构如下图所示。

index.html
<!DOCTYPE HTML>
<html>
<head>
<script id="sap-ui-bootstrap"
src="resources/sap-ui-core.js"
data-sap-ui-libs="sap.m"
data-sap-ui-theme="sap_bluecrystal" >
</script>
<script>
sap.ui.localResources("webapp");
var app = new sap.m.App("idApp");
var view1 = sap.ui.view({id:"idView1",
viewName:"view.View1",type:sap.ui.core.mvc.ViewType.XML});
</script>
</head>
<body class="sapUiBody" role="application">
<div id="content" ></div>
</body>
</html>View1.xml
<mvc:View
xmlns="sap.m"
xmlns:mvc="sap.ui.core.mvc">
<Text id="idbtn" text="Text from" />
</mvc:View>View1.controller
sap.ui.define([
"sap/ui/core/mvc/Controller"
], function(Controller) {
"use strict";
return Controller.extend("View1");
});neo-app.json
{
"routes": [
{
"path": "/webapp/resources",
"target": {
"type": "service",
"name": "sapui5",
"entryPath": "/resources"
},
"description": "SAPUI5 Resources"
}
]
}浏览器中出现错误

我尝试了几种方法,都没有找到指向View1.xml的方法
先谢谢你,斯里尼。
发布于 2019-11-06 04:44:10
请在脚本标记内使用data-sap-ui-resourceroots'{"webapp": "./" }',视图名称应为index.html中的webapp.view.View1。
发布于 2016-11-01 14:02:14
sap.ui.localResources("webapp");为webapp命名空间注册webapp文件夹。您也可以在控制台中看到这一点。
所以应该是viewName: "webapp.view.View1"。
还请注意,您的控制器也称为webapp.controller.View1:
return Controller.extend("webapp.controller.View1", {..。
https://stackoverflow.com/questions/40348351
复制相似问题