Hands-on Nuxt.js Web Development by Lau Tiam Kok

Hands-on Nuxt.js Web Development by Lau Tiam Kok

Author:Lau Tiam Kok [Lau Tiam Kok]
Language: eng
Format: epub
Publisher: Packt Publishing
Published: 2020-08-13T16:00:00+00:00


import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({

state: {

number: 3

},

actions,

getters,

mutations,

modules: {

a: module1,

b: module2

}

})

Split the root's actions, mutations, and getters into separate files and assemble them in the root index file, as follows:

// store/mutations.js

export default {

mutation1 (state) {

//...

},

mutation2 (state, n) {

//...

}

}

Create modules in .js files with their states, actions, mutations, and getters just like you have learned in the previous sections, as follows:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.