export default store =>{
console.log('store初始化了');
if(uni.getStorageSync('state')){
store.replaceState(JSON.parse(uni.getStorageSync('state')))
}
store.subscribe((mutation, state) => {
// console.log( JSON.stringify(state) )
uni.setStorageSync({
key: 'state',
data: JSON.stringify(state)
})
})
}

1***@qq.com
- 发布:2018-12-10 18:22
- 更新:2019-04-25 18:17
- 阅读:6396


猫猫猫猫 - 用户已离线
状态的持久化存储,可以使用 mp-storage 配合 vuex-persistedstate 插件:http://ext.dcloud.net.cn/plugin?id=280