我下载了backbone.js和underscore.js并将其包含在标签中并定义了模型,但浏览器显示未捕获的错误和匿名函数
<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>Backbone Twitter</title>
</head>
<body>
<h1>Backbone for Testing</h1>
<script src="backbone.js"></script>
<script src=" ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<script src="underscore.js"></script>
<script>
var Tweet = Backbone.Model.extend({
});
console.log(new Tweet({author: 'ABCD', status: 'Hi Backbone Js' }));
</script>
</body>
</html>
我看过他们以相同方式做的教程,对Backbonejs来说是非常新的
答案 0 :(得分:1)
你应该在underscore.js之后移动backbone.js,因为下划线是Backbone的依赖。