Logo

GitLab

Sign in

qiangmj / report-ui

  • Back to Dashboard
  • Project
  • Activity
  • Files
  • Commits
  • Network
  • Graphs
  • Milestones
  • Issues 0
  • Merge Requests 0
  • Labels
  • Wiki
  • Snippets
  • report-ui
  • src
  • store
  • modules
  • cachaView.js
  • init
    c3320218
    qiangmj authored
    2022-11-14 10:51:51 +0800  
    Browse Code »
cachaView.js 398 Bytes
Edit Raw Blame History Permalink
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