我一直在尝试使用cordova开始构建OpenUI5应用程序。我面临的最新问题是我似乎无法使用我当地的资源"文件夹(存储所有OpenUI5 js文件的位置)。我在chrome上运行index.html文件,禁用了Web安全性以允许跨平台调用(因为我在正常模式下在chrome上运行时遇到错误)。
我甚至尝试使用http-server运行index.html页面,但是这不会显示页面,而只是在我尝试在浏览器上访问它时才下载它。
现在,当我尝试加载页面时,chrome的开发人员工具为我提供了these errors。
html页面几乎没有代码。我要做的就是打开一个标题为" Hello World"的空白页面。
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<meta name="msapplication-tap-highlight" content="no" />
<!-- WARNING: for iOS 7, remove the width=device-width and height=device-height attributes. See https://issues.apache.org/jira/browse/CB-4323 -->
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />
<link rel="stylesheet" type="text/css" href="css/index.css" />
<!-- https://sapui5.hana.ondemand.com -->
<!-- https://openui5.hana.ondemand.com -->
<script src= "./resources/sap-ui-core.js"
id= "sap-ui-bootstrap"
data-sap-ui-libs= "sap.m"
data-sap-ui-theme= "sap_bluecrystal">
</script>
<title>Hello World</title>
</head>
<body class="sapUiBody">
<div id="content" ></div>
</body>
</html>
任何有关我如何进行的解决方案都将受到高度赞赏。
PS:使用openui5.hana.ondemand.com/或sapui5.hana.ondemand.com/ urls代替&#34; ./访问库js文件似乎工作正常资源/&#34;
PPS:这个问题在Android模拟器上也存在,所以我认为它不是浏览器问题。
答案 0 :(得分:1)
您可以看到there openui资源库。将此资源文件作为您的www文件夹。并且我正在使用 ../ resources / sap-ui-core.js 可能会帮助你。
答案 1 :(得分:-1)
不幸的是,core-ui只是OpenUI5所需的文件之一。
如果使用Windows,并且由于显然是错误,Chrome将不会从javascript文件加载其他Javascript部分。所以你需要像Apache这样的Web服务器。或者您可以尝试将其放在Chrome快捷方式目标位置:“C:\ Chrome \ Application \ chrome.exe” - 允许文件访问文件:/// C:/OpenUI5/sdk/index.html
答案 2 :(得分:-1)
src= "https://sapui5.hana.ondemand.com/resources/sap-ui-core.js"
id= "sap-ui-bootstrap"
data-sap-ui-libs= "sap.m"
data-sap-ui-theme= "sap_bluecrystal"
或
src= "resources/sap-ui-core.js"
id= "sap-ui-bootstrap"
data-sap-ui-libs= "sap.m"
data-sap-ui-theme= "sap_bluecrystal">