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

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

使用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

在學(xué)習(xí)mvc的途中很糾結(jié),希望幫助

阿神
阿神

閉關(guān)修行中......

全員に返信(1)
小葫蘆

你的源碼里https://github.com/LuDongWei/demo/blob/master/backbone/src/commentModel.js,第34行,你override了Collection的parse方法,然后還什么都沒返回,那必然沒有東西會被注入到Collection里去了。如下:

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

既然什么都沒實(shí)現(xiàn),把上面這個parse方法刪掉吧,一切就正常了

最新のダウンロード
詳細(xì)>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート