首页 > 解决方案 > Quasar Vue 存储忽略状态属性

问题描述

我已经使用组合 API 构建了一个应用程序 Quasar,并且我正在使用 import { createPersistedState } from 'vuex-electron';它来维护会话之间的某些属性。但是在我的情况下,有一个名为“ Search ”的属性,它是一个字符串,我不想保存。我怎么能忽略这个值?即使在阅读文档之后,我也不太确定这是如何完成的。

搜索”处于该状态的原因是因为我需要从应用程序的各个部分访问它。

我的index.ts文件

import { store } from 'quasar/wrappers';
import Vuex from 'vuex';
import { createPersistedState } from 'vuex-electron';

import app from './app';
import { AppState } from 'src/models/types';

export interface StateInterface {
  app: AppState;
}

const vuexElectonPlugin = createPersistedState({
  // whitelist: (mutation) => {
  // },
  // blacklist: (mutation) => {
  // }
});

export default store(function ({ Vue }) {
  Vue.use(Vuex);

  const Store = new Vuex.Store<StateInterface>({
    modules: {
      app
    },
    plugins: [vuexElectonPlugin],
    // enable strict mode (adds overhead!)
    // for dev mode only
    strict: !!process.env.DEBUGGING
  });

  return Store;
});

标签: javascriptvue.jsvuex

解决方案


推荐阅读