keepAliveNames.ts 594 B

1234567891011121314151617181920212223
  1. import { Module } from 'vuex';
  2. import { KeepAliveNamesState, RootStateTypes } from '/@/store/interface/index';
  3. const keepAliveNamesModule: Module<KeepAliveNamesState, RootStateTypes> = {
  4. namespaced: true,
  5. state: {
  6. keepAliveNames: [],
  7. },
  8. mutations: {
  9. // 设置路由缓存(name字段)
  10. getCacheKeepAlive(state: any, data: Array<string>) {
  11. state.keepAliveNames = data;
  12. },
  13. },
  14. actions: {
  15. // 设置路由缓存(name字段)
  16. async setCacheKeepAlive({ commit }, data: Array<string>) {
  17. commit('getCacheKeepAlive', data);
  18. },
  19. },
  20. };
  21. export default keepAliveNamesModule;