Arrays in a Backbone.js Model are essentially static?

前端 未结 4 2116
傲寒
傲寒 2020-12-10 19:23

Why are arrays in a Backbone.js Model essentially static variables?

class exports.Content extends Backbone.Model
    tags: []

then if i mak

4条回答
  •  悲&欢浪女
    2020-12-10 20:15

    benpickles is correct when it comes to Backbone models, and the way to do this in coffeescript in general is to initialize instance properties in the constructor:

    class Foo
      constructor: ->
        @bar = []
    

提交回复
热议问题