使用 SAPUI5 的 Web 应用程序中的标准根方向是什么

What ist the standart root idirecton in a webapplication using SAPUI5

我是 SAPUI5 的新手,javascript 我正在使用 SAPUI5 开发 Web 应用程序。为此,我在 ./logonapp/CustomerList.view.js 中设置了多个视图,在 ./logonapp/CustomerList.controller.js 中设置了控制器。文件夹 "logonapp" 和我的 "index.html" 文件都在我的应用程序的 "wwww" 文件夹中。 现在我必须告诉 SAPUI5 我的视图和控制器所在的位置。所以我正在使用 sap.ui.localResources("???"); 但应该在哪个方向刹车? 我找到了不同的版本,例如:Registering Component Resources 但我不明白。

你可以使用sap.ui.localResources("logonapp");用于注册资源。为此,文件夹 'logonapp' 应与 index.html.

位于同一目录中

你可以这样调用你的视图

var app = new sap.m.App({initialPage:"customerList"});
var page = sap.ui.view({id:"customerList", viewName:"logonapp.CustomerList", type:sap.ui.core.mvc.ViewType.XML});
app.addPage(page);

建议的方法是 bootstrap:

<script
    id="sap-ui-bootstrap"
    src="/resources/sap-ui-core.js"
    data-sap-ui-theme="sap_bluecrystal"
    data-sap-ui-libs="sap.m"
    data-sap-ui-bindingSyntax="complex"
    data-sap-ui-compatVersion="edge"
    data-sap-ui-preload="async"
    data-sap-ui-resourceroots='{
        "sap.ui.demo.wt": "./"
    }' >

data-sap-ui-resourceroots 设置正是您要找的。有关详细信息,请参阅 UI5 Walkthrough Tutorial from the SAPUI5 team. There you will also learn the best practices for you project's folder structure. Maybe you also want to check the Navigation and Routing Tutorial,因为我猜您正在使用多个视图...