现在这水平也就能看到backbone.js的简单模板。。。
<!DOCTYPE html>
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
</head>
<body>
<div id="container">Loading...</div>
<script type="text/template" id="who_template">
<h3>Hello <%= who %></h3>
</script>
</body>
</html>
<script>
var AppView = Backbone.View.extend({
el: '#container',
initialize: function(options) {
this.render();
},
render: function() {
var template = _.template(("#who_template").html());
this.el.html(template({who: 'Backbone!'}));
}
});
setTimeout(function(){
var appView = new AppView();
}, 1000);
</script>