Backbone 的任何实例都不起作用,我的控制台说它是未定义的......
截至目前,它说: 未捕获的类型错误:无法调用未定义的方法“开始”
这与这条线相关:
Backbone.history.start()
这是我的 app.js 代码:
app =
facebookAuth()
class manageView extends Backbone.View
constructor: ->
super
initialize: ->
template: _.template($('#manage').html())
render: ->
$('#page').append(@template())
class AppRouter extends Backbone.Router
routes:
"": "manage"
initialize: ->
manage: ->
new manageView()
$(document).ready( ->
console.log('document ready')
app.AppRouter = new AppRouter()
Backbone.history.start()
)
这就是我包含我的 js 文件的方式(它们都指向正确的路径):
<script type="text/javascript" charset="utf-8" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/underscore-min.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/backbone-min.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/less-1.3.0.min.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/facebook-auth.js"></script>
<script type="text/javascript" charset="utf-8" src="../js/app.js"></script>
谁能告诉我为什么?谢谢!