尝试使用 Backbone.js 通过模板从视图中输出一些值,但列表项未显示在网页上,请查看并告知缺少的内容。谢谢
<script type="text/template" id="myid">
<li> <%= value %> </li>
</script>
<script type="text/javascript">
(function($){
ListView = Backbone.View.extend({
tagName:'ul',
initialize:function(){
this.template = _.template($('#myid').html());
},
render:function(){
this.$el.append(this.template({value:"Joe Blogg"}));
return this;
}
});
$(document).ready(function(e) {
myListView = new ListView();
});
})(jQuery);