BaiduFE / BaiduTemplate

前端模板
183 stars 226 forks source link

在使用过程中发现BaiduTemplate一个严重的bug #28

Closed asoiso closed 11 years ago

asoiso commented 11 years ago
<!doctype html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>baiduTemplate</title>
<script src="https://raw.github.com/wangxiao/BaiduTemplate/master/baiduTemplate.js"></script> 
</head>

<body>
<div id="demo"></div>
<script id="demoTemp" type="text/html">
<%=params.title%>
<%=data[0].id%>
</script>
<script>
//data放前面,params放后面,解析title报错
var result = {  
    "data": [{"id": 1},{"id": 2}],
    "params": {"title": "经典"}
};
document.getElementById("demo").innerHTML = baidu.template("demoTemp",result);
</script>
</body>
</html>
wangxiao commented 11 years ago

感谢反馈,这个bug确实很神奇啊,我尽快修复。

wangxiao commented 11 years ago

新版本中已经修正,之前可能引用的不是最新版。感谢建议。

asoiso commented 11 years ago

用了一下,果然好了!