anchor.js 467 Bytes
Newer Older
1 2 3
'use strict'

export default {
4
  namespaced: true,
5 6 7 8 9 10 11 12 13 14 15 16
  state: {
    shown: false,
    hash: ''
  },
  getters: {},
  mutations: {
    anchorChange: (state, opts) => {
      state.shown = (opts.shown === true)
      state.hash = opts.hash || ''
    }
  },
  actions: {
17 18
    open({ commit }, hash) {
      console.info('MIGUEL!')
19 20
      commit('anchorChange', { shown: true, hash })
    },
21
    close({ commit }) {
22 23 24 25
      commit('anchorChange', { shown: false })
    }
  }
}