Google Chrome 开发者工具控制台抛出此错误:
uncaught reference error: backbone is not defined
当这个 html 文件包含带有库主干.js 的 javascript 时:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Backbone APP</title>
</head>
<body>
<script>
Whisky = Backbone.Model.extend();
firstWhisky = new Whisky({
name : 'Blenders Pride'
});
Whiskies = Backbone.Collection.extend({
Model:Whisky ,
url:"#"
});
first_view = Backbone.View.extend({
el : 'body',
initialize : function() {
this.$el.empty();
this.render();
} ,
render : function() {
this.$el.append("<h1>The Whisky APP</h1>");
this.list_view = new List_view();
this.$el.append(this.list_view.render().el);
return this ;
}
});
List_view = Backbone.View.extend({
tagName : 'ul' ,
render : function() {
this.$el.empty();
this.$el.append("<li>Royal stag</li>");
this.$el.append("<li>Signature </li> ");
return this ;
}
});
index_view = new first_view();
</script>
<script src="LIB/json2.js"></script>
<script src="LIB/underscore-min.js"></script>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="http://backbonejs.org/backbone.js"></script>
</body>
</html>
这个错误的原因是什么?