SoFunction
Updated on 2025-04-05

Solution to the VUEX Pit Pit Road to get $store

Today, I encountered a particularly speechless problem when writing vuex. I searched for half an hour before I found this problem, so I posted it. Everyone won’t be too panic when they encounter the same problem as me.

When I first wrote vuex, I couldn't get $store anyway. Later, I searched for a long time and found out that I was injecting the store instead of the store when I injected the global VUE.

This letter difference may not seem to be a problem, but it just cannot obtain the global $store;

Code presented

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in  with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import font from './static/js/';
import './static/scss/'
 = false
import Store from './store/';
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
Store,
components: { App },
template: '<App/>'
})

That's what I wrote before, so I can't come out, but there is no problem with the logic at all

After that, I changed the capital S to the lowercase S and it came out

// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in  with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import font from './static/js/';
import './static/scss/'
 = false
import store from './store/';
/* eslint-disable no-new */
new Vue({
el: '#app',
router,
store,
components: { App },
template: '<App/>'
})

The above solution to the VUEX Pit Pit Road to Get $store is all the content I share with you. I hope you can give you a reference and I hope you can support me more.