Home

Issue: 2336

Trying to add a mixin to main Vue instance

[issue link]

Hi guys,

I’m trying to add some global data (and methods) to main Vue instance. I don’t want to use Vuex so I end up with creating a plugin for nuxt:


import Vue from 'vue'

Vue.mixin({
    data: {
        my_global_config: 'This'
    },
    created: function () {
        console.log('mixin hook called')
    }
    methods: {}
})

Created method works correctly but I don’t have access to data using
this.$root.my_global_config
Any idea?

This question is available on Nuxt.js community (#c2039)