深拷贝方式(混) 用户1832929600214 2023-04-26 60 阅读1分钟 一、JSON.parse(JSON.stringify()):序列化和反序列 附:当对象中有undefined、function的时候会丢失 二、lodash的cloneDeep() 附:(1).npm i -save lodash (2).import _ from 'lodash'(3)._.cloneDeep() 三、jQuery的.extend()附:(1).npminstalljquery(2).import.extend() 附:(1).npm install jquery (2).import .extend()附:(1).npminstalljquery(2).import from 'jquery'(3). $.extend(a:true深拷贝/false浅拷贝,b:空对象,c:对象) 四、手写迭代递归方法(太麻烦了)