简体   繁体   English

如何使用Derby.js模型数组?

[英]How to use Derby.js model arrays?

I keep getting Fatal error: [object Object] is not an Array and then a server crash, whenever I try to use Derby.js/Racer's model array methods, ( push , insert ) for example. 我不断收到Fatal error: [object Object] is not an Array每当尝试使用Derby.js / Racer的模型数组方法(例如pushinsert )时, Fatal error: [object Object] is not an Array ,然后服务器崩溃。

app.ready (model)->
   model.set 'list', []
   model.push 'list', 'test'

https://github.com/codeparty/racer/issues/71 https://github.com/codeparty/racer/issues/71

The root model has to an object. 根模型必须具有一个对象。 So the below would work. 所以下面的工作。

app.ready (model)->
    model.set 'list.list', []
    model.push 'list.list', 'test'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM