vuex-persistedstate 插件
1.下载插件
npm i vuex-persistedstate
2.在 src/store/index.js 文件下使用插件
import { createStore } from 'vuex'
import createPersistedstate from 'vuex-persistedstate'
import global from './modules/global'
import iframe from './modules/iframe'
import keepAlive from './modules/keepAlive'
import viewTags from './modules/viewTags'
import search from './modules/search'
import flow from './modules/flow'
import table from './modules/table'
import chartPosition from './modules/chartPosition'
import common from './modules/common'
import project from './modules/project'
export default createStore({
modules: {
global,
iframe,
keepAlive,
viewTags,
search,
flow,
table,
chartPosition,
common,
project
},
plugins: [
createPersistedstate({
key: 'project_key',
paths: ['project']
})
]
})