1

我正在尝试使用 XAMPP 在我的本地计算机上安装 SAPUI5。我将文件复制到 htdocs。在 Chrome 中启动 localhost 我得到 SAPUI5 SDK - Demo Kit Overview 页面。

之后,我将“HowTo in 20 seconds”代码的示例代码复制到记事本并将其保存为 HTML 文档。

在浏览器中运行这个文件只会带来一个白页。

我在 Chrome 中寻找开发人员工具,看到了这样的内容:

“无法预加载‘sap.ui.core.library-preload’:未找到 - sap.ui.ModuleSystem”

我希望你能帮我解决这个问题,所以我可以从 SAPUI5 开始

4

6 回答 6

2

打开一个新的记事本文件。用 html 扩展名保存以下代码,例如:helloworld.html

<!DOCTYPE html>
<html>
<head>

  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <title>SAPUI5 in 20 Seconds</title>

  <!- 1.) Load SAPUI5, select theme and control library ->
  <script id="sap-ui-bootstrap"
          type="text/javascript"
          src="https://sapui5.netweaver.ondemand.com/resources/sap-ui-core.js"
          data-sap-ui-theme="sap_goldreflection"
          data-sap-ui-libs="sap.ui.commons"></script>

  <!- 2.) Create a UI5 button and place it onto the page ->
  <script>

    // create the button instance
    var myButton = new sap.ui.commons.Button("btn");

    // set properties, e.g. the text
    myButton.setText("Hello World!");

    // attach an action to the button's "press" event (use jQuery to fade out the button)
    myButton.attachPress(function() { $("#btn").fadeOut(); });

    // place the button into the HTML element defined below
    myButton.placeAt("uiArea");

    // an alternative, more jQuery-like notation for the same is:
    /*
    $(document).ready(function() {
      $("#uiArea").sapui("Button", "btn", {
        text:"Hello World!",
        press: function(){ $("#btn").fadeOut(); }
      });
    });
    */

  </script>
</head>
<body class="sapUiBody">

  <!- This is where you place the UI5 button ->
  <div id="uiArea"></div>

</body>
</html>

现在使用任何现代浏览器打开文件。仅供参考,我们不需要任何服务器来测试这个

于 2015-01-21T06:29:56.497 回答
2

关于这个主题的有用链接,我可以推荐:

他们都使用来自 Github 的 UI5 SplitApp Boilerplate,这是一个示例应用程序,具有基本应用程序结构:https ://github.com/6of5/UI5SplitApp-Boilerplate

也许这可以帮助您开始本地开发

于 2014-02-05T08:42:12.193 回答
1

您可以将 Eclipse 配置为与 SAPUI5 一起使用,并在本地环境中使用 Apache Tomcat 来运行您的应用程序。

  1. 安装 Eclipse - http://www.eclipse.org/downloads/packages/eclipse-ide-java-ee-developers/lunasr2
  2. 安装 Java 运行时环境 - http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html
  3. 安装 Apache Tomcat - http://tomcat.apache.org/download-80.cgi

在 Eclipse 中安装 SAPUI5 工具

  • Eclipse > 帮助 > 安装新软件
  • 在“可用软件站点”中添加一个新站点,网址为:https://tools.hana.ondemand.com/luna
  • 在“使用”选项中选择新站点。
  • 展开 HTML5 UI Development Toolkit & Select UI Development Toolkit for HTML5 (Developer Edition)
  • 下一步并安装(可能需要重新启动 Eclipse)
  • 现在您已经安装了 SAPUI5 工具。如果您创建一个新项目,您现在可以获得一个 SAPUI5 应用程序开发选项。

在服务器中配置 Apache Tomcat

  • 添加服务器,窗口 > 首选项 > 服务器 > 运行时环境 > 添加
  • 选择 Apache Tomcat 8.0(或您使用的任何版本)并选择下一步。
  • 选择Tomcat安装目录并完成。

现在你们都准备好了。创建一个新的 SAPUI5 项目(比如 myProject),添加一些代码。要在 tomcat 上运行它,请右键单击项目,运行方式 > 在服务器上运行。选择您的 Tomcat 服务器,Next & Finish。您的项目将在您的服务器上启动并运行,地址为http://localhost:8080/myProject/

于 2015-04-15T07:05:41.010 回答
0

“预加载失败”消息不应该是致命错误;库预加载文件是一个可选的捆绑优化,以减少 HTTP 请求的数量。

https://github.com/SAP/openui5/issues/119

我认为您可以忽略此警告。我Cross origin requests在加载时遇到问题Component.js,使用python -m SimpleHTTPServer. 你需要的只是一个服务器,选择你喜欢的。

于 2016-09-15T00:55:26.857 回答
0

Daniel
我向您推荐SAPUI Walkthrough作为起点。这是关于如何构建 SAPUI5 应用程序的分步指南/教程,包含有关基石和最佳实践的说明。
对于基础知识,您只需要一个编辑器和一个浏览器(无需网络服务器)。
这个git repo 包含所有演练步骤作为单独的分支。

于 2017-12-26T09:57:16.523 回答
-1

SAP UI5 只是一堆用于开发前端的 UI 库,就像 jQuery 等其他库一样。现在,问题是如何配置 Apache 来提供这些文件?这是提供文件的基本 Apache 配置,此页面可能是一个很好的起点。

于 2013-10-30T18:03:29.737 回答