---
# System prepended metadata

title: Vue Mixins
tags: [Vue, Mixins]

---

# Vue Mixins

###### tags: `Vue` `Mixins`

## How to use
mixin.js

```
export default {
  methods: {
    $methodName() {
        // do something...
    }
  }
};
```
component.vue
```
import minin from "../mixins/minin.js";

new Vue({
  mixins: [mixin],
  created: function () {
    console.log('component hook called');
  }
});
```

## Golbal use
```
Vue.mixin({
  created: function() {
    var myOption = this .$options.myOption
    if (myOption) {
      console .log(myOption);
    }
  }
});
```