Skip to content

Method-Style Access Getter #1569

Closed Answered by posva
max5432112345 asked this question in Help and Questions
Aug 19, 2022 · 3 comments · 4 replies
Discussion options

You must be logged in to vote

It's actually the same as Vuex:

Options stores:

defineStore('store', {
  getters: {
    foo: state => (param) => state.bar + param
  }
})

Setup Stores:

const getItemsByType = computed(() => 
  (element: string) => data.value[element] ? data.value[element] : []
)

Replies: 3 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@posva
Comment options

Comment options

You must be logged in to vote
3 replies
@Liwoj
Comment options

@posva
Comment options

@NukeTheMoon
Comment options

Answer selected by max5432112345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
4 participants
Converted from issue

This discussion was converted from issue #1568 on August 19, 2022 09:03.