企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
## cloneDeepWith + [link](./cloneDeepWith "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L9376 "View in source.") + [npm](https://www.npmjs.com/package/lodash.clonedeepwith "See the npm package.") ``` _.cloneDeepWith(value, [customizer]) ``` 这个方法类似 `_.cloneWith`,除了它会递归拷贝 `value`。 ### 参数 1. value (\*) 要深拷贝的值 2. [customizer] (Function) 这个函数定制返回的拷贝值 ### 返回值 (\*) 返回拷贝后的值 ### 示例 ``` function customizer(value) { if (_.isElement(value)) { return value.cloneNode(true); } } var el = _.cloneDeep(document.body, customizer); console.log(el === document.body); // => false console.log(el.nodeName); // => BODY console.log(el.childNodes.length); // => 20 ```