Stephan-v
Stephan-v

Reputation: 20349

How to mix namespaced mapGetters with global getters?

I have namespaced one of my Vuex modules and I am unsure what syntax I should use for this scenario.

I am currently using this syntax where dealfilters is my namespaced module.

...mapGetters('dealfilters', [
    'dealCount',
    'pending',
    'arrival',
    'nights',
    'tag',
    'sortOptions'
])

How would I go about adding a global getter for this mapgetter helper again? Or even call multiple different namespaced modules inside the mapGetter?

Upvotes: 2

Views: 2142

Answers (1)

Bill Criswell
Bill Criswell

Reputation: 32941

There's nothing wrong with using mapGetters twice. If you don't want to do that you can do the namespace/getterName string as well.

...mapGetters([
  'namespace_foo/thing',
  'namespace_foo/bazzle',
  'namespace_bar/thing',
  'not_namespaced_this_should_work_but_i_dont_know',
])

Upvotes: 3

Related Questions