Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/tensorflow/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将jquery添加到Appcelerator钛移动工作?_Jquery_Titanium_Appcelerator Mobile - Fatal编程技术网

如何将jquery添加到Appcelerator钛移动工作?

如何将jquery添加到Appcelerator钛移动工作?,jquery,titanium,appcelerator-mobile,Jquery,Titanium,Appcelerator Mobile,有可能将jquery集成到Tianium Appcelerator中吗?它能正常工作吗? 否则我们就不能在Tianium appcelerator中集成jquery了 有人帮我吗?你到底想干什么?我不确定没有DOM它是否能正常工作 基本上可以使用任何JS库 您需要在网络视图中查看。外面 WebView,基本上可以使用任何JS 不需要DOM的库 (如json2.js等) (from)查看以下论坛。可以通过从Jquery中删除DOM来使用Jquery 首先,您应该创建一个htlm文件。您应该看到下面

有可能将jquery集成到Tianium Appcelerator中吗?它能正常工作吗? 否则我们就不能在Tianium appcelerator中集成jquery了


有人帮我吗?

你到底想干什么?我不确定没有DOM它是否能正常工作

基本上可以使用任何JS库 您需要在网络视图中查看。外面 WebView,基本上可以使用任何JS 不需要DOM的库 (如json2.js等)


(from)

查看以下论坛。可以通过从Jquery中删除DOM来使用Jquery
首先,您应该创建一个htlm文件。您应该看到下面的代码详细信息。还有jquery函数。不要忘记上传jquery-1.9.min.js

<!DOCTYPE html>
<html class="no-js" lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>Local URL</title>
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="jquery-1.7.1.min.js"></script>
<script>

function firedFromWebView(msg){
    $("div").html(msg);
}

//Notice that jQuery works within WebViews
$(document).ready(function(e){
    $("a").click(function(e){
    //This will fire the custom event "fromWeb" and send the second argument
    //as the event's value
        Titanium.App.fireEvent("fromWeb",{value:"Fired from webpage"});
    });
});
</script>
</head>
<body>
    <h1>A Local Webpage</h1>
    <a href="javascript:void(0)">Touch to Fire Event</a>
    <br/>
    <div>Listening...</div>
</body>
</html>

本地URL
函数firedFromWebView(msg){
$(“div”).html(msg);
}
//请注意,jQuery在WebView中工作
$(文档).ready(函数(e){
$(“a”)。单击(功能(e){
//这将触发自定义事件“fromWeb”,并发送第二个参数
//作为事件的价值
tianium.App.firevent(“fromWeb”{value:“从网页中激发”});
});
});
本地网页

听。。。
另一个更新代码块出现在app.js上

var win = Titanium.UI.createWindow({
    title:"App to Web View Interaction Through Events",
    backgroundColor:"#FFFFFF"
});

var webView = Titanium.UI.createWebView({
    url:"html/index.html"
});

var button = Titanium.UI.createButton({
    title:"Fire WebView Javascript",
    height:48,
    width:220,
    bottom:12
});

button.addEventListener("click",function(e){
    webView.evalJS("firedFromWebView('<strong>Fired!</strong>')");
});

//We can use a custom event listener to fire native code from Javascript pages
//by using Titanium.App.addEventListener
Titanium.App.addEventListener("fromWeb",function(e){
    //The data structure and value of e is defined in the
    //index.html page
    alert(e.value);
});

win.add(webView);
win.add(button);
win.open();
var win=tianium.UI.createWindow({
标题:“通过事件的应用程序到Web视图交互”,
背景颜色:“FFFFFF”
});
var webView=Titanium.UI.createWebView({
url:“html/index.html”
});
var按钮=tianium.UI.createButton({
标题:“FireWebView Javascript”,
身高:48,
宽度:220,
底数:12
});
按钮。addEventListener(“单击”,函数(e){
evalJS(“firedFromWebView('Fired!');
});
//我们可以使用自定义事件侦听器从Javascript页面触发本机代码
//通过使用Titanium.App.addEventListener
Titanium.App.addEventListener(“fromWeb”,函数(e){
//e的数据结构和值在
//index.html页面
警觉(e.value);
});
win.add(webView);
win.add(按钮);
win.open();