- 终端
npm i vuex-persistedstate
- store/index.js引入插件
import createPersistedstate from 'vuex-persistedstate'
- 结点配置插件
// 配置插件
plugins: [
// 默认存储在localStorge上
createPersistedstate({
key: 'eshop-client-pc-store',
paths: ['user', 'cart']
})
]