在Phonegap上使用AFUI和jquery时"Uncaught TypeError: Property 'touchLayer' of object function ( selector,



我正在使用phonegap部署安卓版afui(Intel Appframework UI)中的web应用程序,但是,当我在安卓模拟器中测试它时,调试控制台在我刚刚启动应用程序后显示以下错误:

Uncaught TypeError: Property 'touchLayer' of object function (selector, context) 
// The jQuery object is actually just the init constructor 'enhanced' 
return new jQuery.fn.init( selector, context, rootjQuery ); 
} is not a function at file:///android_asset/www/ui/appframework.ui.js:3281

并且所有javascript功能都被禁用。

我搞不清楚问题出在哪里。我已经在Elementary操作系统上用chrome测试了这个应用程序,它运行得很好。

我使用的是phonegap 3.1.0-0.15.0、jQuery 1.10.2和App Framework UI 2.0。

我正在按以下顺序导入js文件:

<script type="text/javascript" src="cordova.js"></script>
<script type="text/javascript" src="js/jquery.js"></script>
<script src="js/jq.appframework.js"></script>
<script type="text/javascript" charset="utf-8" src="ui/appframework.ui.js"></script>

我希望有人能帮我找到解决这个问题的办法。

我也遇到了同样的问题。最终,通过查看Appframework Kitchen Sink中的index.html,我发现要使错误消失,需要在应用程序index.html中使用以下脚本:

var webRoot = "./";
$.ui.autoLaunch = false; //By default, it is set to true and you're app will run right away.  We set it to false to show a splashscreen
/* This function runs when the body is loaded.*/
var init = function () {
$.ui.backButtonText = "Back";// We override the back button text to always say "Back"
window.setTimeout(function () {
$.ui.launch();
}, 1500);//We wait 1.5 seconds to call $.ui.launch after DOMContentLoaded fires
};
document.addEventListener("DOMContentLoaded", init, false);
$.ui.ready(function () {
//This function will get executed when $.ui.launch has completed
});

我还不知道为什么需要这个代码,但这里也记录了它的使用。

相关内容

最新更新