yaya template,支持完整javascirpt语法的前端模板 执行速度最快的前端模板
yaya template是一个轻量级前端模版,所用指令仅需{$...$}和{%...%},前者包含需要输出html语句,后者包含js变量。 支持javascript完整语法,你可以写for或者while或者其他任一javascript的语法。 同时,yaya template也是目前翻译与渲染数据执行速度最快的前端模板。
下载1.1.0版
yaya template的使用方法很简单
yaya template的{$...$}与{%...%}
使用yaya template的一些说明
例1 ajax获取数据并渲染
page1 page2
模板内容
 
			
		
ajax获取数据并通过render渲染,映射json数据
 
				var template1 = YayaTemplate(document.getElementById("template1").innerHTML);
				function page(url){
					baidu.ajax.get(url,function(xhr,responseText){				
						document.getElementById("list").innerHTML = template1.render({
								"json":baidu.json.parse(responseText)
						});
					});
				}		
		
例2 xapp数据渲染
模板内容
 
			
		
渲染
 
			var xappList = YayaTemplate(document.getElementById("xappList").innerHTML);
			baidu.ajax.get("content.txt",function(xhr,responseText){				
				xappList.render({"json":baidu.json.parse(responseText)});
				var Drag = new IphoneDrag();
				Drag.init({
						container:'ListWrapper',
						width:100,
						height:100,
						marginX:20,
						marginY:20,
						speed:80
				});  
			});
		
版本历史