0

我有继承的主干视图:

class App.Views.User.Base extends Backbone.View
  el: '#main'

  initialize: ->

  events:
    'click .save': 'save'

  render: ->
    @$el.html @template user: @model
    @    


class App.Views.User.Registration extends App.Views.User.Base
  template: JST['template/users/registration']

  save: ->
    if not @model.expired()
      @model.save {},
        error: (model, response) ->
          console.log response.responseText

当我试图渲染这个时:

(new FancySurvey.Views.User.Registration(model: model)).render()

我得到了错误:

Property 'template' of object #<Registration> is not a function

可能是什么问题?谢谢

4

1 回答 1

0

问题是模板文件的路径错误,在我的情况下应该是

class App.Views.User.Registration extends App.Views.User.Base
  template: JST['users/registration']
  ...
于 2013-07-10T18:58:59.107 回答