A
A
Alexander2018-12-06 17:51:59
HTML
Alexander, 2018-12-06 17:51:59

Why do I keep getting an error when trying to get information from the Vuex store: error during evaluation?

Greetings, dear community,
I’m trying to tie the store for vue
and I can’t understand what the problem
is, I can’t pull the state from the store directly or through getters , I
constantly see this error during evaluation
in the vue debugger, while in the vuex debugger everything is OK
5c0933834cdf5850919253.png5c093390e8877885383013.png
the code of the store (without modules)

import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);

const store = new Vuex.Store({
    strict: true,
    state: {
        rootstate: 'storeJs'
    },
    getters: {
        getRootState: function (state) {
            return state.rootstate
        }
    },
    mutations: {},
    actions: {}
});

export default {
    store
}

computed: {
            ...mapGetters([
                'CARCLASS_PRICES',
                'getRootState'
            ]),
            count() {
                return this.$store.state.getRootState;
            }
        },

something I can’t understand at all
in the console, the entire store can be
displayed, but if I try to reach the getter, it says that such a property was not found
methods: {
            testStore: function (e) {
                console.log(this.$store.getters.getRootState);
                // return store;
            }
        },

Cannot read property 'getRootState' of undefined

Answer the question

In order to leave comments, you need to log in

5 answer(s)
S
Sanan Yuzb, 2016-01-12
@Sanan07

Take the trapezoid from here https://css-tricks.com/examples/ShapesOfCSS/ and use :before with absolute positioning. To rotate usetransform:rotate(число deg)

X
xmoonlight, 2016-01-12
@xmoonlight

to freelance!

S
Sergey, 2016-01-12
@gangstarcj

I don't see anything complicated. Just a div with a fill and text in the center. The label can be made by the before tag with absolute positioning

A
Anna Shatkovskaya, 2018-12-25
@Miki8887

I think you need to rewrite the repository a bit.
Store to be like this:

import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
  //используемые модули
  modules: {
  ...
  }
})

And each module according to the following type:
const state = {
...
}
const getters = {
...
}
const actions = {
...
}
const mutations = {
...
}
export default {
  state,
  getters,
  actions,
  mutations,
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question