//服务器端
koa2Router.use(async (ctx, next) => {
const memoryHistory = createMemoryHistory(ctx.url);
const history = syncHistoryWithStore(memoryHistory, store, {
selectLocationState (state) {
return state.get('routing').toObject();
}
});
await next();
});
//前端
const history = syncHistoryWithStore(browserHistory, store, {
selectLocationState (state) {
return state.get('routing').toObject();
}
});
log:
//服务器端
{ type: '@@router/LOCATION_CHANGE',
payload:
{ pathname: '/vols/678',
search: '',
hash: '',
state: null,
action: 'POP',
key: 'ofet3q',
query: {},
'$searchBase': { search: '', searchBase: '' } } }
//前端
action: {
payload: {
pathname:"/vols/678",
search:"",
hash:"",
state:null,
action:"POP",
key:"pe6t4r",
query: {},
$searchBase: {
search:"",
searchBase:""
}
}
}
//除了key值不一致外,其他信息都一样,但为什么生成的key值会不一致呢?