Usually with this
problems it is related to scope, but in your case it is just related to a typo in your html
method call:
render(){
this.$el.html(this.template(this.model.toJSON())); // fixed
return this;
}
To set the HTML of an element, you pass the HTML inside the parenthesis of the html
method - you accidentally passed no arguments (so this GETS the HTML, rather than SETS the HTML) and then tried to call the resulting string of HTML like a function.
this.$el.html() // returns a string of HTML
this.$el.html('<div>Hello World</div>') // sets the html to the supplied string
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…