# \_.mixin

**语法：**

```javascript
_.mixin([object=lodash], source, [options={}])
```

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

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

**描述：**

添加来源对象自身的所有可枚举函数属性到目标对象。 如果`object`是个函数，那么函数方法将被添加到原型链上。

> **注意:**&#x4F7F;用[`_.runInContext`](https://lodash.com/docs/4.17.10#runInContext)来创建原始的`lodash`函数来避免修改造成的冲突。

**开始版本：**&#x30;.1.0

**参数：**

* `[object=lodash] (Function|Object)`: 目标对象。
* `source (Object)`: 来源对象。
* `[options={}] (Object)`: 选项对象。
* `[options.chain=true] (boolean)`: 是否开启链式操作。

**返回值：**

* `(*)`: 返回 object.

**例子：**

```javascript
function vowels(string) {
  return _.filter(string, function(v) {
    return /[aeiou]/i.test(v);
  });
}

_.mixin({ 'vowels': vowels });
_.vowels('fred');
// => ['e']

_('fred').vowels().value();
// => ['e']

_.mixin({ 'vowels': vowels }, { 'chain': false });
_('fred').vowels();
// => ['e']
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://lodash.shujuwajue.com/util/mixin.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
