Blame view

report-ui/src/store/modules/cachaView.js 398 Bytes
王涛 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

const cacheView = {
  state: {
    cacheViews: []
  },

  mutations: {
    ADD_CACHEVIEW: (state, view) => {
      if (state.cacheViews.includes(view.name)) return
      if (view.meta && view.meta.keepAlive) {
        state.cacheViews.push(view.name)
      } 
    }
  },
  actions: {
    addCachedView({ commit }, view ) {
      commit('ADD_CACHEVIEW', view)
    }
  }
}

export default cacheView