Examples of how to use the modules in a Vue component
See original GitHub issueHaving been frustrated by vuex-typescript
I thought I would give this ago but I find that I am struggling without, apparently, any examples of how to import and use the modules (and the getters, actions etc) in a standard Typescript Vue component.
It looks like it could be a useful library but the README is too lightweight at the moment. Any chance of some better, more complete examples?
Issue Analytics
- State:
- Created 5 years ago
- Comments:22 (7 by maintainers)
Top Results From Across the Web
Separating a Vue project into modules | by Keagan Chisnall
Have you ever wanted to properly separate your Vue project into plugin-type modules? In this example I'll show you the basics of making...
Read more >Building external modules in VueJS - Pusher Blog
When we create an external module, we can use the same module across multiple projects. ... An example of this is vue-custom-element.
Read more >Modules | Vuex
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 >Vue Modules, Components & Data Binding | VueJS EP 03
VueJS makes it easy to work with data binding. We'll focus on the basics understanding of data in Javascript and text interpolation.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Yackbz In Nuxt, index.ts can have export functions and objects, and that is where your nuxtServerInit() belongs. That function can then call server initialisation functions in modules.
So, for example:
Note that the above code doesn’t use vuex-module-decorators for the index.ts, but it does for everything else. Also see #124 for an example of what the store-accessor would look like.
After much faffing around I defined the module like this:
Then accessed it in my Vue component like this:
Then
Then I was able to access methods etc elsewhere - for example
But it seems a bit contrived. Is this a good way or is there a better way, considering that I am not using
vue-class-component
?