国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

node.js - backbone Collection fetch 返回的數(shù)據(jù)無法添加到集合
阿神
阿神 2017-04-17 11:32:45
0
1
202

使用backbone的Model的集合的時候使用

    self.fetch({
        success : function(Collection,resp){
            console.log(self.length) // 0
            console.log(resp)  //[{},{}] 有數(shù)據(jù)
        }
    });

無法把數(shù)據(jù)添加到集合中。

接口我使用的是nodejs的的接口get后數(shù)據(jù)是正常的

代碼我放到了git上,地址為:
后端:https://github.com/LuDongWei/demo/tree/master/node-address
前端:https://github.com/LuDongWei/demo/tree/master/backbone

在學習mvc的途中很糾結,希望幫助

阿神
阿神

閉關修行中......

reply all(1)
小葫蘆

In your source code https://github.com/LuDongWei/demo/blob/master/backbone/src/commentModel.js, line 34, you override the parse method of Collection and then return nothing, so nothing will be injected into Collection. As follows:

parse : function(a,b){
    // console.log(a)
    // console.log(b)
}

Since nothing is implemented, delete the above parse method and everything will be normal

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template