question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Example using vuex modules

See original GitHub issue

I’ve used Vuex before but never in this module sense. I am purely trying to use the vuex Counter that this package ships with. I’ve tried the following to no resolve any help would be nice. /src/renderer/store/modules/Counter.js

const state = {
  main: 0
}

const mutations = {
  DECREMENT_MAIN_COUNTER (state) {
    state.main--
  },
  INCREMENT_MAIN_COUNTER (state) {
    state.main++
  }
}

const actions = {
  someAsyncTask ({ commit }) {
    // do something async
    commit('INCREMENT_MAIN_COUNTER')
  }
}

export default {
  state,
  mutations,
  actions
}

/src/renderer/views/Welcome.vue

<template lang="pug">
  button(@click="test")
</template>

<script>
export default {
  name: 'Welcome',
  data () {
    return {

    }
  },
  methods: {
    test () {
      // what I expect to work
      this.$store.dispatch('someAsyncTask')
      // what I expected with "modules"
      this.$store.dispatch('Counter.someAsyncTask')
      // another attempt
      this.$store.Counter.dispatch('someAsyncTask')
    }
  }
}
</script>

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:7

github_iconTop GitHub Comments

6reactions
Lionad-Morotarcommented, Mar 23, 2019
1reaction
RogerPaladincommented, Jan 24, 2019

import { createNamespacedHelpers } from 'vuex'

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modules
To help with that, Vuex allows us to divide our store into modules. Each module can contain its own state, mutations, actions, getters, ......
Read more >
Vuex Modules - A Vue.js Lesson From our Vue.js Course
Each Vuex modules can contain its own state, mutations, actions, getters and even their own modules. In this vue.js tutorial, we'll learn how...
Read more >
Vuex modules example
Vuex modules example. 1. Embed Fork Create Sandbox Sign in. Sandbox Info. Vuex modules example. 1. 1.5k. 33. nemoipahanemoipaha. Environmentvue-cli. Files.
Read more >
Managing multiple store modules with Vuex
Vuex modules are essentially small, independent Vuex stores that are combined into a larger, central Vuex store. This makes managing them much ...
Read more >
Vuex Modules Tutorial, how to scale your Store
Vuex Modules are simply Vuex stores inside other Vuex stores. Don't worry, it is much simpler than it sounds. In our previous tutorial,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found