赞
踩
> npm install redux-persist
npm install --save redux-persist-transform-filter
依赖
"redux-persist": "^6.0.0",
"redux-persist-transform-filter": "0.0.20",
src -----> app.js
import { persistStore, persistReducer } from 'redux-persist'
import storage from 'redux-persist/lib/storage'
const persistConfig = { key: 'root', storage, whitelist: ['regionInfo','urbanInfo','shopInfo','event'], // 配置白名单 里面写需要配置的名字 } // 数据持久化 const persistEnhancer = () => createStore => (reducer, initialState, enhancer) => { const store = createStore(persistReducer(persistConfig, reducer), initialState, enhancer); const persist = persistStore(store); return {...store, persist }; } export const dva = { config: { extraEnhancers: [persistEnhancer()] } }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。