Vue.js Mixins Global Mixin


You can also apply a mixin globally. Use caution! Once you apply a mixin globally, it will affect every Vue instance created afterwards. When used properly, this can be used to inject processing logic for custom options:

// inject a handler for `myOption` custom option
  created: function () {
    var myOption = this.$options.myOption
    if (myOption) {

new Vue({
  myOption: 'hello!'
// -> "hello!"

Use global mixins sparsely and carefully, because it affects every single Vue instance created, including third party components. In most cases, you should only use it for custom option handling like demonstrated in the example above.