如何将命名空间的 mapGetter 与全局 getter 混合使用?
How to mix namespaced mapGetters with global getters?
我已经为我的一个 Vuex 模块命名空间,但我不确定在这种情况下应该使用什么语法。
我目前正在使用这种语法,其中 dealfilters
是我的命名空间模块。
...mapGetters('dealfilters', [
'dealCount',
'pending',
'arrival',
'nights',
'tag',
'sortOptions'
])
我该如何再次为这个 mapgetter 助手添加一个全局 getter?或者甚至在 mapGetter 中调用多个不同的命名空间模块?
两次使用 mapGetters 没有错。如果你不想这样做,你也可以使用 namespace/getterName
字符串。
...mapGetters([
'namespace_foo/thing',
'namespace_foo/bazzle',
'namespace_bar/thing',
'not_namespaced_this_should_work_but_i_dont_know',
])
我已经为我的一个 Vuex 模块命名空间,但我不确定在这种情况下应该使用什么语法。
我目前正在使用这种语法,其中 dealfilters
是我的命名空间模块。
...mapGetters('dealfilters', [
'dealCount',
'pending',
'arrival',
'nights',
'tag',
'sortOptions'
])
我该如何再次为这个 mapgetter 助手添加一个全局 getter?或者甚至在 mapGetter 中调用多个不同的命名空间模块?
两次使用 mapGetters 没有错。如果你不想这样做,你也可以使用 namespace/getterName
字符串。
...mapGetters([
'namespace_foo/thing',
'namespace_foo/bazzle',
'namespace_bar/thing',
'not_namespaced_this_should_work_but_i_dont_know',
])