首页 > Backbone save() 时报 Converting circular structure to JSON

Backbone save() 时报 Converting circular structure to JSON

数据结构:

{
    images: [
        src: 'xxxx',
        title: 'xxxx'
    ], [
        src: 'xxxx',
        title: 'xxxx'
    ],
    ...
}

读取和显示的时候都是没有问题的

但在 model.save()时会报错:

Converting circular structure to JSON

定位到:1376行

params.data = JSON.stringify(options.attrs || model.toJSON(options));

难道需要改数据结构了?


{
    images:[ {
        src: 'xxxx',
        title: 'xxxx'
    }, {
        src: 'xxxx',
        title: 'xxxx'
    }]
}

应该这样吧;

【热门文章】
【热门文章】