Can't access this.$store (vuex) in any child component after basic installation












3














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:




  1. in main.js:


use import store from './store'; rather than import { store } from './store';




  1. in main.js:


use store: store, rather than store,




  1. in store.js:


use Vue.use(Vuex); rather than Vue.use(Vuex, {});




  1. 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




  1. put the console not in created hook, but in methods, and made a button to trigger it.


  2. 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.










share|improve this question
























  • 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 '18 at 21:48






  • 1




    What's happening? An error that this.$store is undefined?
    – ceejayoz
    Nov 14 '18 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 '18 at 21:52










  • @ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
    – Min XIE
    Nov 14 '18 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 '18 at 22:37


















3














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:




  1. in main.js:


use import store from './store'; rather than import { store } from './store';




  1. in main.js:


use store: store, rather than store,




  1. in store.js:


use Vue.use(Vuex); rather than Vue.use(Vuex, {});




  1. 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




  1. put the console not in created hook, but in methods, and made a button to trigger it.


  2. 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.










share|improve this question
























  • 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 '18 at 21:48






  • 1




    What's happening? An error that this.$store is undefined?
    – ceejayoz
    Nov 14 '18 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 '18 at 21:52










  • @ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
    – Min XIE
    Nov 14 '18 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 '18 at 22:37
















3












3








3







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:




  1. in main.js:


use import store from './store'; rather than import { store } from './store';




  1. in main.js:


use store: store, rather than store,




  1. in store.js:


use Vue.use(Vuex); rather than Vue.use(Vuex, {});




  1. 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




  1. put the console not in created hook, but in methods, and made a button to trigger it.


  2. 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.










share|improve this question















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:




  1. in main.js:


use import store from './store'; rather than import { store } from './store';




  1. in main.js:


use store: store, rather than store,




  1. in store.js:


use Vue.use(Vuex); rather than Vue.use(Vuex, {});




  1. 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




  1. put the console not in created hook, but in methods, and made a button to trigger it.


  2. 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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 14 '18 at 21:46







Min XIE

















asked Nov 14 '18 at 21:41









Min XIEMin XIE

517




517












  • 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 '18 at 21:48






  • 1




    What's happening? An error that this.$store is undefined?
    – ceejayoz
    Nov 14 '18 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 '18 at 21:52










  • @ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
    – Min XIE
    Nov 14 '18 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 '18 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 '18 at 21:48






  • 1




    What's happening? An error that this.$store is undefined?
    – ceejayoz
    Nov 14 '18 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 '18 at 21:52










  • @ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
    – Min XIE
    Nov 14 '18 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 '18 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 '18 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 '18 at 21:48




1




1




What's happening? An error that this.$store is undefined?
– ceejayoz
Nov 14 '18 at 21:49




What's happening? An error that this.$store is undefined?
– ceejayoz
Nov 14 '18 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 '18 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 '18 at 21:52












@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 '18 at 22:33






@ceejayoz sorry thst I even forgot to mention that. I got exactly this.$store is undefined
– Min XIE
Nov 14 '18 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 '18 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 '18 at 22:37














1 Answer
1






active

oldest

votes


















-1














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>





share|improve this answer





















  • 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 '18 at 2:51












  • Let me clarify then, it's unrelated to the problem whether you use store or { store }
    – Simon Hyll
    Nov 15 '18 at 3:43






  • 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 '18 at 4:36










  • Then you didn't read the question nor my answer properly if that's what you think.
    – Simon Hyll
    Nov 15 '18 at 5:13






  • 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 '18 at 10:11











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















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

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









-1














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>





share|improve this answer





















  • 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 '18 at 2:51












  • Let me clarify then, it's unrelated to the problem whether you use store or { store }
    – Simon Hyll
    Nov 15 '18 at 3:43






  • 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 '18 at 4:36










  • Then you didn't read the question nor my answer properly if that's what you think.
    – Simon Hyll
    Nov 15 '18 at 5:13






  • 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 '18 at 10:11
















-1














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>





share|improve this answer





















  • 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 '18 at 2:51












  • Let me clarify then, it's unrelated to the problem whether you use store or { store }
    – Simon Hyll
    Nov 15 '18 at 3:43






  • 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 '18 at 4:36










  • Then you didn't read the question nor my answer properly if that's what you think.
    – Simon Hyll
    Nov 15 '18 at 5:13






  • 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 '18 at 10:11














-1












-1








-1






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>





share|improve this answer












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>






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 15 '18 at 2:29









Simon HyllSimon Hyll

9541922




9541922












  • 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 '18 at 2:51












  • Let me clarify then, it's unrelated to the problem whether you use store or { store }
    – Simon Hyll
    Nov 15 '18 at 3:43






  • 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 '18 at 4:36










  • Then you didn't read the question nor my answer properly if that's what you think.
    – Simon Hyll
    Nov 15 '18 at 5:13






  • 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 '18 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 '18 at 2:51












  • Let me clarify then, it's unrelated to the problem whether you use store or { store }
    – Simon Hyll
    Nov 15 '18 at 3:43






  • 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 '18 at 4:36










  • Then you didn't read the question nor my answer properly if that's what you think.
    – Simon Hyll
    Nov 15 '18 at 5:13






  • 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 '18 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 '18 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 '18 at 2:51














Let me clarify then, it's unrelated to the problem whether you use store or { store }
– Simon Hyll
Nov 15 '18 at 3:43




Let me clarify then, it's unrelated to the problem whether you use store or { store }
– Simon Hyll
Nov 15 '18 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 '18 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 '18 at 4:36












Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 '18 at 5:13




Then you didn't read the question nor my answer properly if that's what you think.
– Simon Hyll
Nov 15 '18 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 '18 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 '18 at 10:11


















draft saved

draft discarded




















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

How to pass form data using jquery Ajax to insert data in database?

National Museum of Racing and Hall of Fame

Guess what letter conforming each word