wikijs-fork/client/js/store/modules/anchor.js

23 lines
423 B
JavaScript
Raw Normal View History

2017-05-22 17:32:52 +00:00
export default {
namespaced: true,
2017-05-22 17:32:52 +00:00
state: {
shown: false,
hash: ''
},
getters: {},
mutations: {
anchorChange: (state, opts) => {
state.shown = (opts.shown === true)
state.hash = opts.hash || ''
}
},
actions: {
open({ commit }, hash) {
2017-05-22 17:32:52 +00:00
commit('anchorChange', { shown: true, hash })
},
close({ commit }) {
2017-05-22 17:32:52 +00:00
commit('anchorChange', { shown: false })
}
}
}