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 ```