使用lodash.cloneDeep实现深拷贝

import _ from 'lodash'
var obj = {id:1,name:{a:'xx'},fn:function(){}};
var obj2 = _.cloneDeep(obj);
obj2.name.a = 'obj2';
console.log(obj,obj2)

posted @ 2020-07-31 10:08  春风自是人间客  阅读(1716)  评论(0编辑  收藏  举报