let newEvent = event;
console.log(changes, event, newEvent);
newEvent.title = changes.title;
newEvent.description = changes.description;
console.log(changes, event, newEvent);
输出的第一个console.log
:
{title:' Event 2',description:' blaat'}
{title:'活动1',说明:''}
{title:'活动1',说明:''}
这就是我的预期,但是没有预料到的是输出的下一个console.log
:
{title:' Event 2',description:' blaat'}
{title:' Event 2',description:' blaat'}
{title:' Event 2',description:' blaat'}
我期待以下输出:
{title:' Event 2',description:' blaat'}
{title:'活动1',说明:''}
{title:' Event 2',description:' blaat'}
有没有人可以帮我解决这个问题,谢谢id advance