首先,我尝试在listview中显示静态数据。代码如下:
<ul id="accessList">
</ul>
<script>
var dataTest = [{"abc":"123"}, {"abc":"456"}];
(function () {
$(document).bind("pageinit", function () {
$("#accessList").html($("#accessTemplate").render(dataTest)).listview();
}());
}());
</script>
<script id="accessTemplate" type="text/x-jsrender">
<li>
<div>{{:abc}}</div>
</li>
</script>
但是它给了我以下错误:
Uncaught TypeError: Object [object Object] has no method 'render'
我做错了什么?
按照Scott的建议,我在jQuery Mobile之前添加了jsrender脚本。