Vuex-module-decorators: Possibility of using a getter with a parameter?

Created on 24 Oct 2018  路  2Comments  路  Source: championswimmer/vuex-module-decorators

Hi @championswimmer 馃槂

I was wondering if there is a way with your plugin to define a method with parameters as a getter?

get getUser() { ... } works
get getUser(id: string) { ... } does not work since the ES6 syntax does not allow get methods to have parameters

I didn't find anything about that in your code but I was thinking about something like:

@Getter
getUser(id: string) { ... }

Or maybe I missed something?

Thank you,

Most helpful comment

This should be in the documentation :)

All 2 comments

you return a function from getter

get getUser() { return function (id: string) { /* ... */ } }

This should be in the documentation :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

souphuhn picture souphuhn  路  5Comments

BonBonSlick picture BonBonSlick  路  5Comments

darthf1 picture darthf1  路  5Comments

blainehansen picture blainehansen  路  4Comments

kwekujoe picture kwekujoe  路  5Comments