Javascript &引用;未捕获类型错误:属性';触摸层';对象函数(选择器、上下文)的;在phonegap上使用afui和jquery时
我正在使用phonegap部署在Android版afui(Intel Appframework UI)中制作的web应用程序,但是,当我在Android仿真器中测试它时,调试控制台在我刚刚启动应用程序后显示以下错误:Javascript &引用;未捕获类型错误:属性';触摸层';对象函数(选择器、上下文)的;在phonegap上使用afui和jquery时,javascript,android,jquery,cordova,appframework,Javascript,Android,Jquery,Cordova,Appframework,我正在使用phonegap部署在Android版afui(Intel Appframework UI)中制作的web应用程序,但是,当我在Android仿真器中测试它时,调试控制台在我刚刚启动应用程序后显示以下错误: Uncaught TypeError: Property 'touchLayer' of object function (selector, context) // The jQuery object is actually just the init construc
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功能都被禁用
我想不出是什么问题。我已经在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厨房水槽中的index.html,我发现要使错误消失,需要在app 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
});
我还不知道为什么需要这个代码,但是它的使用也有文档记录 如果您没有将应用程序设置为延迟启动,则touchlayer初始化和在启动中使用的时间显然存在争用条件。因此,在上面的代码中,启动前的1.5秒等待允许初始化完成。请看,我在代码中将$.ui.autoLaunch的值更改为true,我刚刚将其改回false,现在它可以工作了,谢谢;