1

フォルダー "view" からビューを読み込もうとすると、"resource view/View1.view.xml could not load from resources/view/View1.view.xml" というエラーが表示されます。WebIDE のフォルダ構成は下図のようになっています。

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.コントローラー

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 を指す方法が見つかりませんでした

前もってありがとう、スリニ。

4

2 に答える 2

0

sap.ui.localResources("webapp");webapp名前空間の webapp フォルダーを登録します。コンソールでも確認できます。

だからそうあるべきですviewName: "webapp.view.View1"

また、コントローラーはwebapp.controller.View1と呼ばれることにも注意してください。

return Controller.extend("webapp.controller.View1", {

...

于 2016-11-01T06:02:14.073 に答える