Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using vue-loading within vuex store #38

Closed
nezaboravi opened this issue Nov 18, 2019 · 2 comments
Closed

Using vue-loading within vuex store #38

nezaboravi opened this issue Nov 18, 2019 · 2 comments
Labels

Comments

@nezaboravi
Copy link

nezaboravi commented Nov 18, 2019

Hi,
Adding vue-loading in store wont work.
When i add it inside component, al works.

My bootstrap file:

import Loading from 'vue-loading-overlay';
import 'vue-loading-overlay/dist/vue-loading.css';

Vue.use(Loading);
Vue.use(VueNoty);
Vue.use(Vuex);

Here is the current code- inside store/index.js

    actions: {
        setAds({ commit }, category) {
            let loader = this.$loading.show({
                // Optional parameters
                loader: 'dots',
                height: 255,
                width: 255,
                color: '#7DC242'
            });
            axios.get('/ads', { params: { category: category } }).then(data => {
                let ads = data.data.data;
                commit('ads', ads);
                loader.hide()
            });
        },

Here is the error photo:
Screenshot 2019-11-18 16 30 02

@ankurk91
Copy link
Owner

I don't think this refers to a Vue instance here, you can import vue and can use it like

// in your vuex store
import Vue from 'vue;

Vue.$loading.show({})

@nezaboravi
Copy link
Author

Just Vue.$loading works, no need to import Vue in store. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants