Skip to content

Instantly share code, notes, and snippets.

@DezChuang
Last active January 15, 2019 02:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DezChuang/0d18d1abaf0db74b302956c8068e3649 to your computer and use it in GitHub Desktop.
Save DezChuang/0d18d1abaf0db74b302956c8068e3649 to your computer and use it in GitHub Desktop.
myPage.vue
async fetch({ app, store }) {
app.$registerStore({
module: MyModule,
moduleName: `myModule`,
store
})
await store.dispatch('myModule/INIT_DATA')
},
beforeCreate() {
this.$registerStore({
module: MyModule,
moduleName: `myModule`,
store: this.$store
})
},
beforeDestroy() {
this.$store.unregisterModule('myModule')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment