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.

Vuex store or plugins generally

See original GitHub issue

Hi , I am currently playing around with this set of projects (using the CLI tool) . i wish to know how to use vuex store with this given that there is no new Vue instance that takes a store property or any other custom plugin for that matter that needs to be injected into the global vue object instance as a prototype or property. I tried creating a store plugin like in boot/setup.vue

Vue.use(VueNativeBase)
const store = createStore()
Vue.use(Vuex)
const storePlugin = {
  install(Vue, options) {
    Vue.prototype.$store = store
  },
}
Vue.use(storePlugin)

but i get an errror that states undefined is not an object (evaluating plugin.installed)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

13reactions
aaronksaunderscommented, Jun 30, 2018

@fergardi @atilacamurca i found it easier to just do this in App.vue

  Vue.prototype.$store = store;

otherwise you cannot use any of the vuex helpers mapGetters or mapActions

1reaction
waldandradecommented, Oct 30, 2018

Guys, Vue presume you gonna use computed data to that go.

computed: {
   btnClickCount: function() {
     return Store.state.count
   }
 },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Plugins - Vuex
Vuex stores accept the plugins option that exposes hooks for each mutation. A Vuex plugin is simply a function that receives the store...
Read more >
Plugins - Vuex ORM
Plugins usually add global-level functionality to Vuex ORM. Vuex ORM plugin works ... Vuex ORM Axios – A plugin to sync the store...
Read more >
Creating a Vuex Plugin - Shawn Wildermuth
A Vuex plugin is a simple function that is called once during the setup of a Vuex store. Typically you'd just create the...
Read more >
Make your vuex store globally available by registering it as a ...
Create a vuex store and attach it to the global Vue object so you can access it as this.$myStore from a component.
Read more >
Is there a way to encapsulate Vuex store inside Vue plugin (its ...
Vuex plugin uses store option to assign store instance to Vue.prototype.$store , similarly to your own plugin. If the intention is to use ......
Read more >

github_iconTop Related Medium Post

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