-
-
Save nejtr0n/a55d37d39af36af6e27d78ee186bf803 to your computer and use it in GitHub Desktop.
Vuex Nested Modules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| export default { | |
| namespaced: true, | |
| state: { | |
| firstname: 'John', | |
| lastname: 'Doe', | |
| email: '[email protected]' | |
| }, | |
| getters: { | |
| fullname: state => `${state.firstname} ${state.lastname}` | |
| }, | |
| mutations: { | |
| updatemail(state, email) { | |
| state.email = email; | |
| } | |
| }, | |
| actions: { | |
| emailupdate(context, email) { | |
| context.commit('updatemail', email); | |
| } | |
| }, | |
| modules: { | |
| account: { | |
| state: { | |
| type: 'Admin', | |
| created: '2018-01-12 21:33:54 UTC', | |
| active: true | |
| } | |
| }, | |
| posts: { | |
| namespaced: true, | |
| state: { | |
| articles: [...] | |
| } | |
| } | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment