Can't access this.$store (vuex) in any child component after basic installation
up vote
3
down vote
favorite
So I am totally new to vuex. I carefully install the vuex to my vue app but I can't acess the this.$store in any of my child component.
I have also read more than 10 questions ask the same thing and I did a lot of changes, tried lots of times. Since I thought I did everything right and it still doesn't work. I finally decide to come here and ask. I will put my own codes below:
file structure (only related files):
|---main.js
|---store.js
|---App.vue
|---components
main.js:
import '@babel/polyfill'
import Vue from 'vue'
import App from './App.vue'
import './plugins/vuetify'
import './plugins/vue-resource'
import { store } from './store';
require('../node_modules/ol/ol.css');
Vue.config.productionTip = false
fetch('static/App_Config.json')
.then(function (response) {
return response.json().then(function (AppConfig) {
Vue.prototype.$AppConfig = AppConfig;
new Vue({
store,
render: h => h(App)
}).$mount('#app')
});
})
store.js:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex, {
});
export const store = new Vuex.Store({
state: {
testText: "test string"
}
});
in components: (simplified, only related codes)
<script>
created () {
console.log("this.$store_test: ", this.$store);
}
</script>
I have already tried these possibilties:
- in main.js:
use import store from './store';
rather than import { store } from './store';
- in main.js:
use store: store
, rather than store,
- in store.js:
use Vue.use(Vuex);
rather than Vue.use(Vuex, {});
- in store.js: (combined with 1. I have tried all 4 combinitions)
use export default store = new Vuex.Store
rather than export const store = new Vuex.Store
put the console not in created hook, but in methods, and made a button to trigger it.
put the console in other child components, which nested in different deeps
After I serched a lot similar qustions and tried a lot (also with 20+ time server restart). I still can get this.$store. I kind of need some help.
I DO NOT think this question is duplicate, because I have already read other questions and tried all the possiblities. If they all failed, it must be something new here with mine codes.
vue.js vuejs2 vuex
add a comment |
up vote
3
down vote
favorite
So I am totally new to vuex. I carefully install the vuex to my vue app but I can't acess the this.$store in any of my child component.
I have also read more than 10 questions ask the same thing and I did a lot of changes, tried lots of times. Since I thought I did everything right and it still doesn't work. I finally decide to come here and ask. I will put my own codes below:
file structure (only related files):
|---main.js
|---store.js
|---App.vue
|---components
main.js:
import '@babel/polyfill'
import Vue from 'vue'
import App from './App.vue'
import './plugins/vuetify'
import './plugins/vue-resource'
import { store } from './store';
require('../node_modules/ol/ol.css');
Vue.config.productionTip = false
fetch('static/App_Config.json')
.then(function (response) {
return response.json().then(function (AppConfig) {
Vue.prototype.$AppConfig = AppConfig;
new Vue({
store,
render: h => h(App)
}).$mount('#app')
});
})
store.js:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex, {
});
export const store = new Vuex.Store({
state: {
testText: "test string"
}
});
in components: (simplified, only related codes)
<script>
created () {
console.log("this.$store_test: ", this.$store);
}
</script>
I have already tried these possibilties:
- in main.js:
use import store from './store';
rather than import { store } from './store';
- in main.js:
use store: store
, rather than store,
- in store.js:
use Vue.use(Vuex);
rather than Vue.use(Vuex, {});
- in store.js: (combined with 1. I have tried all 4 combinitions)
use export default store = new Vuex.Store
rather than export const store = new Vuex.Store
put the console not in created hook, but in methods, and made a button to trigger it.
put the console in other child components, which nested in different deeps
After I serched a lot similar qustions and tried a lot (also with 20+ time server restart). I still can get this.$store. I kind of need some help.
I DO NOT think this question is duplicate, because I have already read other questions and tried all the possiblities. If they all failed, it must be something new here with mine codes.
vue.js vuejs2 vuex
FYI, it's best to list the other questions you've looked at and if possible, explain why / how they didn't work for you. It helps avoid this getting prematurely closed as a duplicate
– Phil
Nov 14 at 21:48
1
What's happening? An error thatthis.$store
is undefined?
– ceejayoz
Nov 14 at 21:49
1
If your component example is trimmed down, could you at least show it as an actual component, egexport default { created() { ... } }
. Otherwise, if your code is actually what you've got, then that's not how you write a component
– Phil
Nov 14 at 21:52
@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 at 22:33
1
@Phil sorry that I maybe cut the component too much. Yes they are all real components. I am actually not new to vue.js. Just need to use vuex because of another problem I have got (you can see it in my other questions, but it is not related to this qustion). They are all real components and my app works fine. Only the veux part is the problem so I asked this question
– Min XIE
Nov 14 at 22:37
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
So I am totally new to vuex. I carefully install the vuex to my vue app but I can't acess the this.$store in any of my child component.
I have also read more than 10 questions ask the same thing and I did a lot of changes, tried lots of times. Since I thought I did everything right and it still doesn't work. I finally decide to come here and ask. I will put my own codes below:
file structure (only related files):
|---main.js
|---store.js
|---App.vue
|---components
main.js:
import '@babel/polyfill'
import Vue from 'vue'
import App from './App.vue'
import './plugins/vuetify'
import './plugins/vue-resource'
import { store } from './store';
require('../node_modules/ol/ol.css');
Vue.config.productionTip = false
fetch('static/App_Config.json')
.then(function (response) {
return response.json().then(function (AppConfig) {
Vue.prototype.$AppConfig = AppConfig;
new Vue({
store,
render: h => h(App)
}).$mount('#app')
});
})
store.js:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex, {
});
export const store = new Vuex.Store({
state: {
testText: "test string"
}
});
in components: (simplified, only related codes)
<script>
created () {
console.log("this.$store_test: ", this.$store);
}
</script>
I have already tried these possibilties:
- in main.js:
use import store from './store';
rather than import { store } from './store';
- in main.js:
use store: store
, rather than store,
- in store.js:
use Vue.use(Vuex);
rather than Vue.use(Vuex, {});
- in store.js: (combined with 1. I have tried all 4 combinitions)
use export default store = new Vuex.Store
rather than export const store = new Vuex.Store
put the console not in created hook, but in methods, and made a button to trigger it.
put the console in other child components, which nested in different deeps
After I serched a lot similar qustions and tried a lot (also with 20+ time server restart). I still can get this.$store. I kind of need some help.
I DO NOT think this question is duplicate, because I have already read other questions and tried all the possiblities. If they all failed, it must be something new here with mine codes.
vue.js vuejs2 vuex
So I am totally new to vuex. I carefully install the vuex to my vue app but I can't acess the this.$store in any of my child component.
I have also read more than 10 questions ask the same thing and I did a lot of changes, tried lots of times. Since I thought I did everything right and it still doesn't work. I finally decide to come here and ask. I will put my own codes below:
file structure (only related files):
|---main.js
|---store.js
|---App.vue
|---components
main.js:
import '@babel/polyfill'
import Vue from 'vue'
import App from './App.vue'
import './plugins/vuetify'
import './plugins/vue-resource'
import { store } from './store';
require('../node_modules/ol/ol.css');
Vue.config.productionTip = false
fetch('static/App_Config.json')
.then(function (response) {
return response.json().then(function (AppConfig) {
Vue.prototype.$AppConfig = AppConfig;
new Vue({
store,
render: h => h(App)
}).$mount('#app')
});
})
store.js:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex, {
});
export const store = new Vuex.Store({
state: {
testText: "test string"
}
});
in components: (simplified, only related codes)
<script>
created () {
console.log("this.$store_test: ", this.$store);
}
</script>
I have already tried these possibilties:
- in main.js:
use import store from './store';
rather than import { store } from './store';
- in main.js:
use store: store
, rather than store,
- in store.js:
use Vue.use(Vuex);
rather than Vue.use(Vuex, {});
- in store.js: (combined with 1. I have tried all 4 combinitions)
use export default store = new Vuex.Store
rather than export const store = new Vuex.Store
put the console not in created hook, but in methods, and made a button to trigger it.
put the console in other child components, which nested in different deeps
After I serched a lot similar qustions and tried a lot (also with 20+ time server restart). I still can get this.$store. I kind of need some help.
I DO NOT think this question is duplicate, because I have already read other questions and tried all the possiblities. If they all failed, it must be something new here with mine codes.
vue.js vuejs2 vuex
vue.js vuejs2 vuex
edited Nov 14 at 21:46
asked Nov 14 at 21:41
Min XIE
477
477
FYI, it's best to list the other questions you've looked at and if possible, explain why / how they didn't work for you. It helps avoid this getting prematurely closed as a duplicate
– Phil
Nov 14 at 21:48
1
What's happening? An error thatthis.$store
is undefined?
– ceejayoz
Nov 14 at 21:49
1
If your component example is trimmed down, could you at least show it as an actual component, egexport default { created() { ... } }
. Otherwise, if your code is actually what you've got, then that's not how you write a component
– Phil
Nov 14 at 21:52
@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 at 22:33
1
@Phil sorry that I maybe cut the component too much. Yes they are all real components. I am actually not new to vue.js. Just need to use vuex because of another problem I have got (you can see it in my other questions, but it is not related to this qustion). They are all real components and my app works fine. Only the veux part is the problem so I asked this question
– Min XIE
Nov 14 at 22:37
add a comment |
FYI, it's best to list the other questions you've looked at and if possible, explain why / how they didn't work for you. It helps avoid this getting prematurely closed as a duplicate
– Phil
Nov 14 at 21:48
1
What's happening? An error thatthis.$store
is undefined?
– ceejayoz
Nov 14 at 21:49
1
If your component example is trimmed down, could you at least show it as an actual component, egexport default { created() { ... } }
. Otherwise, if your code is actually what you've got, then that's not how you write a component
– Phil
Nov 14 at 21:52
@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 at 22:33
1
@Phil sorry that I maybe cut the component too much. Yes they are all real components. I am actually not new to vue.js. Just need to use vuex because of another problem I have got (you can see it in my other questions, but it is not related to this qustion). They are all real components and my app works fine. Only the veux part is the problem so I asked this question
– Min XIE
Nov 14 at 22:37
FYI, it's best to list the other questions you've looked at and if possible, explain why / how they didn't work for you. It helps avoid this getting prematurely closed as a duplicate
– Phil
Nov 14 at 21:48
FYI, it's best to list the other questions you've looked at and if possible, explain why / how they didn't work for you. It helps avoid this getting prematurely closed as a duplicate
– Phil
Nov 14 at 21:48
1
1
What's happening? An error that
this.$store
is undefined?– ceejayoz
Nov 14 at 21:49
What's happening? An error that
this.$store
is undefined?– ceejayoz
Nov 14 at 21:49
1
1
If your component example is trimmed down, could you at least show it as an actual component, eg
export default { created() { ... } }
. Otherwise, if your code is actually what you've got, then that's not how you write a component– Phil
Nov 14 at 21:52
If your component example is trimmed down, could you at least show it as an actual component, eg
export default { created() { ... } }
. Otherwise, if your code is actually what you've got, then that's not how you write a component– Phil
Nov 14 at 21:52
@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 at 22:33
@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 at 22:33
1
1
@Phil sorry that I maybe cut the component too much. Yes they are all real components. I am actually not new to vue.js. Just need to use vuex because of another problem I have got (you can see it in my other questions, but it is not related to this qustion). They are all real components and my app works fine. Only the veux part is the problem so I asked this question
– Min XIE
Nov 14 at 22:37
@Phil sorry that I maybe cut the component too much. Yes they are all real components. I am actually not new to vue.js. Just need to use vuex because of another problem I have got (you can see it in my other questions, but it is not related to this qustion). They are all real components and my app works fine. Only the veux part is the problem so I asked this question
– Min XIE
Nov 14 at 22:37
add a comment |
1 Answer
1
active
oldest
votes
up vote
-1
down vote
This is a valid Vuex store.js
file:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
testText: "test string";
}
});
export default store;
Remember to create a getter
, mutation
and action
for your variables in Vuex, you should not handle the state directly.
It doesn't matter in main.js
if you use store
or store: store
, they are identical.
import store from './store'
is the same as import { store } from './store'
.
Vue.use(Vuex)
and Vue.use(Vuex, {})
are the same as long as you don't supply any options.
You don't need to get the store in a component somewhere, you're loading Vuex before the app is mounted, so you can actually start using it in e.g. the main.js
created hook.
Your components <script>
tag is incorrect. You should use export default
, like this:
<script>
export default {
created () {
// Check if console.log like this works better as well
console.log("Store test:");
console.log(this.$store);
}
}
</script>
import store from './store'
is NOT the same asimport { store } from './store'.
One is getting the entire object, one is destructuring.
– A. Lau
Nov 15 at 2:51
Let me clarify then, it's unrelated to the problem whether you usestore
or{ store }
– Simon Hyll
Nov 15 at 3:43
1
His export is defined as thisexport const store
.import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.
– A. Lau
Nov 15 at 4:36
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
1
There's nothing wrong with his store definition. I'm thinking it's thefetch
part, but then again I've never doneVue.use
inside afetch
– A. Lau
Nov 15 at 10:11
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
-1
down vote
This is a valid Vuex store.js
file:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
testText: "test string";
}
});
export default store;
Remember to create a getter
, mutation
and action
for your variables in Vuex, you should not handle the state directly.
It doesn't matter in main.js
if you use store
or store: store
, they are identical.
import store from './store'
is the same as import { store } from './store'
.
Vue.use(Vuex)
and Vue.use(Vuex, {})
are the same as long as you don't supply any options.
You don't need to get the store in a component somewhere, you're loading Vuex before the app is mounted, so you can actually start using it in e.g. the main.js
created hook.
Your components <script>
tag is incorrect. You should use export default
, like this:
<script>
export default {
created () {
// Check if console.log like this works better as well
console.log("Store test:");
console.log(this.$store);
}
}
</script>
import store from './store'
is NOT the same asimport { store } from './store'.
One is getting the entire object, one is destructuring.
– A. Lau
Nov 15 at 2:51
Let me clarify then, it's unrelated to the problem whether you usestore
or{ store }
– Simon Hyll
Nov 15 at 3:43
1
His export is defined as thisexport const store
.import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.
– A. Lau
Nov 15 at 4:36
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
1
There's nothing wrong with his store definition. I'm thinking it's thefetch
part, but then again I've never doneVue.use
inside afetch
– A. Lau
Nov 15 at 10:11
add a comment |
up vote
-1
down vote
This is a valid Vuex store.js
file:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
testText: "test string";
}
});
export default store;
Remember to create a getter
, mutation
and action
for your variables in Vuex, you should not handle the state directly.
It doesn't matter in main.js
if you use store
or store: store
, they are identical.
import store from './store'
is the same as import { store } from './store'
.
Vue.use(Vuex)
and Vue.use(Vuex, {})
are the same as long as you don't supply any options.
You don't need to get the store in a component somewhere, you're loading Vuex before the app is mounted, so you can actually start using it in e.g. the main.js
created hook.
Your components <script>
tag is incorrect. You should use export default
, like this:
<script>
export default {
created () {
// Check if console.log like this works better as well
console.log("Store test:");
console.log(this.$store);
}
}
</script>
import store from './store'
is NOT the same asimport { store } from './store'.
One is getting the entire object, one is destructuring.
– A. Lau
Nov 15 at 2:51
Let me clarify then, it's unrelated to the problem whether you usestore
or{ store }
– Simon Hyll
Nov 15 at 3:43
1
His export is defined as thisexport const store
.import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.
– A. Lau
Nov 15 at 4:36
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
1
There's nothing wrong with his store definition. I'm thinking it's thefetch
part, but then again I've never doneVue.use
inside afetch
– A. Lau
Nov 15 at 10:11
add a comment |
up vote
-1
down vote
up vote
-1
down vote
This is a valid Vuex store.js
file:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
testText: "test string";
}
});
export default store;
Remember to create a getter
, mutation
and action
for your variables in Vuex, you should not handle the state directly.
It doesn't matter in main.js
if you use store
or store: store
, they are identical.
import store from './store'
is the same as import { store } from './store'
.
Vue.use(Vuex)
and Vue.use(Vuex, {})
are the same as long as you don't supply any options.
You don't need to get the store in a component somewhere, you're loading Vuex before the app is mounted, so you can actually start using it in e.g. the main.js
created hook.
Your components <script>
tag is incorrect. You should use export default
, like this:
<script>
export default {
created () {
// Check if console.log like this works better as well
console.log("Store test:");
console.log(this.$store);
}
}
</script>
This is a valid Vuex store.js
file:
import Vue from 'vue';
import Vuex from 'vuex';
Vue.use(Vuex);
const store = new Vuex.Store({
state: {
testText: "test string";
}
});
export default store;
Remember to create a getter
, mutation
and action
for your variables in Vuex, you should not handle the state directly.
It doesn't matter in main.js
if you use store
or store: store
, they are identical.
import store from './store'
is the same as import { store } from './store'
.
Vue.use(Vuex)
and Vue.use(Vuex, {})
are the same as long as you don't supply any options.
You don't need to get the store in a component somewhere, you're loading Vuex before the app is mounted, so you can actually start using it in e.g. the main.js
created hook.
Your components <script>
tag is incorrect. You should use export default
, like this:
<script>
export default {
created () {
// Check if console.log like this works better as well
console.log("Store test:");
console.log(this.$store);
}
}
</script>
answered Nov 15 at 2:29
Simon Hyll
9531922
9531922
import store from './store'
is NOT the same asimport { store } from './store'.
One is getting the entire object, one is destructuring.
– A. Lau
Nov 15 at 2:51
Let me clarify then, it's unrelated to the problem whether you usestore
or{ store }
– Simon Hyll
Nov 15 at 3:43
1
His export is defined as thisexport const store
.import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.
– A. Lau
Nov 15 at 4:36
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
1
There's nothing wrong with his store definition. I'm thinking it's thefetch
part, but then again I've never doneVue.use
inside afetch
– A. Lau
Nov 15 at 10:11
add a comment |
import store from './store'
is NOT the same asimport { store } from './store'.
One is getting the entire object, one is destructuring.
– A. Lau
Nov 15 at 2:51
Let me clarify then, it's unrelated to the problem whether you usestore
or{ store }
– Simon Hyll
Nov 15 at 3:43
1
His export is defined as thisexport const store
.import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.
– A. Lau
Nov 15 at 4:36
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
1
There's nothing wrong with his store definition. I'm thinking it's thefetch
part, but then again I've never doneVue.use
inside afetch
– A. Lau
Nov 15 at 10:11
import store from './store'
is NOT the same as import { store } from './store'.
One is getting the entire object, one is destructuring.– A. Lau
Nov 15 at 2:51
import store from './store'
is NOT the same as import { store } from './store'.
One is getting the entire object, one is destructuring.– A. Lau
Nov 15 at 2:51
Let me clarify then, it's unrelated to the problem whether you use
store
or { store }
– Simon Hyll
Nov 15 at 3:43
Let me clarify then, it's unrelated to the problem whether you use
store
or { store }
– Simon Hyll
Nov 15 at 3:43
1
1
His export is defined as this
export const store
. import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.– A. Lau
Nov 15 at 4:36
His export is defined as this
export const store
. import store from "./store"
will not work. Your answer is not related to the problem either, it doesn't answer anything.– A. Lau
Nov 15 at 4:36
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 at 5:13
1
1
There's nothing wrong with his store definition. I'm thinking it's the
fetch
part, but then again I've never done Vue.use
inside a fetch
– A. Lau
Nov 15 at 10:11
There's nothing wrong with his store definition. I'm thinking it's the
fetch
part, but then again I've never done Vue.use
inside a fetch
– A. Lau
Nov 15 at 10:11
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53309129%2fcant-access-this-store-vuex-in-any-child-component-after-basic-installation%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
FYI, it's best to list the other questions you've looked at and if possible, explain why / how they didn't work for you. It helps avoid this getting prematurely closed as a duplicate
– Phil
Nov 14 at 21:48
1
What's happening? An error that
this.$store
is undefined?– ceejayoz
Nov 14 at 21:49
1
If your component example is trimmed down, could you at least show it as an actual component, eg
export default { created() { ... } }
. Otherwise, if your code is actually what you've got, then that's not how you write a component– Phil
Nov 14 at 21:52
@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 at 22:33
1
@Phil sorry that I maybe cut the component too much. Yes they are all real components. I am actually not new to vue.js. Just need to use vuex because of another problem I have got (you can see it in my other questions, but it is not related to this qustion). They are all real components and my app works fine. Only the veux part is the problem so I asked this question
– Min XIE
Nov 14 at 22:37