带有PhoneGap的Kendo UI未初始化
问题描述:
我有一个超级基本的PhoneGap iOS解决方案,但似乎并未显示Kendo UI正在初始化。我正在使用PhoneGap 2.6使用Kendo UI Mobile 2013 Q1构建带有PhoneGap的Kendo UI未初始化
我似乎无法发现问题。
这里是我的代码
<!DOCTYPE html>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<html>
<head>
<meta charset="utf-8" />
<meta name="format-detection" content="telephone=no" />
<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" />
<title>Hello World</title>
<script type="text/javascript" src="cordova-2.6.0.js"></script>
<script type="text/javascript" src="js/index.js"></script>
<script src="js/jquery.min.js"></script>
<script src="js/kendo.mobile.min.js"></script>
<script type="text/javascript" src="js/kendo.all.min.js"></script>
<script src="js/custom.js"></script>
<script src="js/datasource.js"></script>
<script type="text/javascript" src="js/script.js"></script>
<link href="styles/kendo.common.min.css" rel="stylesheet" />
<link href="styles/kendo.bootstrap.min.css" rel="stylesheet" />
<link href="styles/kendo.common.min.css" rel="stylesheet" type="text/css">
<link href="styles/kendo.mobile.all.min.css" rel="stylesheet" type="text/css">
<link href="styles/styles.css" rel="stylesheet" type="text/css">
</head>
<body>
<div data-role="view" id="main">
<a href="#page2" data-role="button">Go to Page 2</a>
</div>
<div data-role="view" id="page2">
My Page 2
</div>
<script type="text/javascript">
//cordovaApp.initialize();
</script>
<script>
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
app = new kendo.mobile.Application() {
transition: "slide",
platform: "ios"
}
</script>
</body>
</html>
答
好了,想通了:
<script type="text/javascript">
$(function() {
document.addEventListener("deviceready", onDeviceReady, false);
function onDeviceReady() {
// Now safe to use the Cordova API
var app = new kendo.mobile.Application()
}
});
</script>
答
在脚本参考,使用的是kendo.mobile.min.js和kendo.all.min.js。 mobile.min.js中只有一个必须用在kendo.all.min.js中,它会弄乱整个应用程序。一旦你删除kendo.mobile.min.js,你的应用程序应该工作。
我给那个了一枪,遗憾的是它仍然没有奏效。另外,这个代码(减去cordova refs)适用于我的本地主机 – Rob 2013-04-22 14:32:06
iOS设备区分大小写的文件名......是否所有文件的命名都与源代码中的大小写相同? – Whizkid747 2013-04-22 14:44:17
是的,双重检查了所有来源。有没有什么JS我可以在xcode中注册某种控制台来告诉我什么是破坏? – Rob 2013-04-22 14:58:04