當在mutations 里面去添加路由的時候,報錯了。剛接觸vuex 不是很清楚這里的關(guān)系,希望各位大佬能夠解答一二。什么情況下會出現(xiàn)這種問題,給予一個思路也是可以的。mutations :{ // 動態(tài)添加主界面路由,需要緩存
updateAppRouter: (state, routes) => {
state.routers.push(...routes)
router.addRoutes(routes)
}, // 動態(tài)添加全局路由,不需要緩存
updateDefaultRouter (state, routes) {
router.addRoutes(routes)
},
}
- 2 回答
- 0 關(guān)注
- 500 瀏覽
添加回答
舉報
0/150
提交
取消