Moved hamburger logic to store & auto hide on route change

This commit is contained in:
2022-01-14 17:02:00 +01:00
parent 5431b5be40
commit 9f3745b71c
5 changed files with 38 additions and 23 deletions

19
src/modules/hamburger.js Normal file
View File

@@ -0,0 +1,19 @@
export default {
namespaced: true,
state: {
open: false
},
getters: {
isOpen: state => state.open
},
mutations: {
SET_OPEN: state => (state.open = true),
SET_CLOSE: state => (state.open = false),
TOGGLE: state => (state.open = !state.open)
},
actions: {
open: ({ commit }) => commit("SET_OPEN"),
close: ({ commit }) => commit("SET_CLOSE"),
toggle: ({ commit }) => commit("TOGGLE")
}
};