Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎮 示例相关 | store的commit方式问题 #39

Open
Mrlilili opened this issue Jul 2, 2020 · 0 comments
Open

🎮 示例相关 | store的commit方式问题 #39

Mrlilili opened this issue Jul 2, 2020 · 0 comments

Comments

@Mrlilili
Copy link

Mrlilili commented Jul 2, 2020

async asideLoad ({ state, dispatch }) {
// store 赋值
const menu = await dispatch('d2admin/db/get', {
dbName: 'sys',
path: 'menu',
defaultValue: setting.menu,
user: true
}, { root: true })
state.asideCollapse = menu.asideCollapse !== undefined ? menu.asideCollapse : setting.menu.asideCollapse
state.asideTransition = menu.asideTransition !== undefined ? menu.asideTransition : setting.menu.asideTransition
}

实例代码中直接在action中修改state的状态这里有些不妥。

更改 Vuex 的 store 中的状态的唯一方法是提交 mutation。
-vuex文档

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant