Business background
- Learning
nuxtstaticvueProject - migrate a completed vue project to the nuxt framework
Perplexities encountered
- in
vue, the definitionvuexis an instance object defined directly
the code is as follows:
export default new Vuex.Store({
state: {
},
mutations: {
},
debug: true
});
- but in the
nuxtofficial document, it is defined in this way
sample code is as follows:
const createStore = () => {
return new Vuex.Store({
state: {
},
mutations: {
}
})
}
question
-
nuxtwhat is the reason for doing this? Instantiate objects only when called to save performance? - if I want to call the
storeobject on another non-component page, don"t I have to re-instantiate it again?
