hoh_xili 2021-07-06 22:08 采纳率: 33.3%
浏览 183

jsonArray格式传参,后边的数据会把前边的数据覆盖掉怎么办

data: {
id: id ? id : '',
name: name,
subDesc: subDesc ? subDesc : '',
startDate: beginTime,
endDate: endTime,
questionCycle: '1',
numCopies: 6,
questionProblem: [
{
problemNo: problemNo,
type: type,
level: 2,
title: title,
isAnswer: isAnswer,
subDesc: subDesc2 ? subDesc2 : '',
questionOption: [
{
optionNo,
content,
subDesc: subDesc3 ? subDesc3 : '',
},
],
},
],
},

  • 写回答

2条回答 默认 最新

  • blkq 2021-07-06 22:19
    关注

    你是说这种:id: id ? id : ''吗?
    这个不是覆盖,这个是设置默认值。当id的值是null的时候,就取''。

    如果你发现实际值与你期望的不一致,检查一下赋值前,id是不是null

    评论

报告相同问题?