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));

难道需要改数据结构了?

阅读 2.9k
1 个回答
{
    images:[ {
        src: 'xxxx',
        title: 'xxxx'
    }, {
        src: 'xxxx',
        title: 'xxxx'
    }]
}

应该这样吧;

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进