> For the complete documentation index, see [llms.txt](https://lodash.shujuwajue.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lodash.shujuwajue.com/lang/clonedeepwith.md).

# \_.cloneDeepWith（数据的深克隆）

**语法：**

```javascript
_.cloneDeepWith(value, [customizer])
```

**源代码链接：**[source](https://github.com/lodash/lodash/blob/4.17.10/lodash.js#L11118)

**npm包链接：**[npm package](https://www.npmjs.com/package/lodash.clonedeepwith)

**描述：**

这个方法类似[`_.cloneWith`](https://lodash.com/docs/4.17.10#cloneWith)，除了它会递归克隆`value`。

**开始版本：**&#x34;.0.0

**参数：**

* `value (*)`: 用来递归克隆的值。
* `[customizer] (Function)`: 用来自定义克隆的函数。

**返回值：**

* `(*)`: 返回深度克隆后的值。

**例子：**

```javascript
function customizer(value) {
  if (_.isElement(value)) {
    return value.cloneNode(true);
  }
}

var el = _.cloneDeepWith(document.body, customizer);

console.log(el === document.body);
// => false
console.log(el.nodeName);
// => 'BODY'
console.log(el.childNodes.length);
// => 20
```
