1
백본, 마리오 네트 및 coffeescript를 사용하여 다중 페이징 된 앱을 만들려고합니다.백본, xxx는 생성자가 아닙니다?
애플 리케이션/home.coffee
define [
'App'
'./index/index'
],
(App, HomeIndex) ->
class HomeApp extends App
constructor :() ->
super
console.log typeof HomeIndex #return object
@homeIndex = new HomeIndex() #TypeError: HomeIndex is not a constructor
@initialize()
initialize: ->
console.log 'app initialize'
App.contentArea.show homeIndex
애플 리케이션/홈/색인/index.coffee
define [],
()->
class HomeIndex extends Backbone.Marionette.Layout
template: '<div>Hello, Backbone! </div>'
constructor:() ->
console.log '!'
initialize: (options) ->
@template = _.template @template
console.log "Home Index initialized"
render:() =>
@$el.html @template
내가 HomeIndex가, 누군가가 내가 뭘 잘못 알고 초기화 할 수 없습니다?
define [
'App'
'apps/home/index/index'
],
을 여전히 대해서 typeof HomeIndex 반환 객체는 작동하지 :
업데이트 조언을 바랍니다.