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 : '',
},
],
},
],
},
jsonArray格式传参,后边的数据会把前边的数据覆盖掉怎么办
- 写回答
- 好问题 0 提建议
- 关注问题
- 邀请回答
-
2条回答 默认 最新
blkq 2021-07-06 22:19关注你是说这种:id: id ? id : ''吗?
这个不是覆盖,这个是设置默认值。当id的值是null的时候,就取''。如果你发现实际值与你期望的不一致,检查一下赋值前,id是不是null
解决 无用评论 打赏 举报