浏览器 |我们可以将哪些选项传递给提交方法?
Vuex | What options can we pass to the commit method?
如果你看一下 Vuex commit()
函数,you can see that it accepts a third argument named _options
。当我已经在一个模块中时需要从模块提交突变时,我有时会使用 root: true
来设置它。
commit('main/toggleMenu', { menu: 'right' }, { root: true })
我找不到关于此参数的任何文档。你知道这些选项是什么吗?
来自 documentation for commit
:
options
can have root: true
that allows to commit root mutations in namespaced modules.
看来这是目前唯一可以传递给 options
参数的选项。
如果你看一下 Vuex commit()
函数,you can see that it accepts a third argument named _options
。当我已经在一个模块中时需要从模块提交突变时,我有时会使用 root: true
来设置它。
commit('main/toggleMenu', { menu: 'right' }, { root: true })
我找不到关于此参数的任何文档。你知道这些选项是什么吗?
来自 documentation for commit
:
options
can haveroot: true
that allows to commit root mutations in namespaced modules.
看来这是目前唯一可以传递给 options
参数的选项。