How to use @Getter with Parameters
See original GitHub issueIf I have the following getter setup:
const getters: GetterTree<IMyState, any> = {
// academies: (state, getters) => x.academies,
academy: (s) => ((id: number) => s.items.find((x) => x.id === id)),
};
How can I use the @Getter
decorator in my component to execute my getter based on a vue property:
@Component
export default class MyComponent extends Vue {
@Prop({required: true})
public id: number;
@Getter
public item
}
I want to bind the id
property of my component and use @Getter
to retrieve one of a collection of items.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:3
- Comments:9 (1 by maintainers)
Top Results From Across the Web
vuexjs getter with argument - Stack Overflow
getter is meant to do. first, as you can see in all the above examples the getter can be mapped as a computed...
Read more >Getters | Vuex
Vuex allows us to define "getters" in the store. You can think of them as computed properties for stores. As of Vue 3.0,...
Read more >How To Pass Arguments To The Vuex Getters
To do this we can use the "Method-Style Access" method provided by vuex. Using this defining method, we can send arguments to the...
Read more >How to pass parameters to the function in getters #688 - GitHub
Use an Action to handle the api call. Update the store with a mutation. Use a getter to 'shape' the data into what's...
Read more >Pass arguments to a Vuex getter - Jérémy Riverain
Passing arguments to a vuex getter is very useful. It makes them more powerful. However, the syntax to do it is quite tricky....
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
Just call the getter.
is done with