提交 7567ddd9 编写于 作者: tony001's avatar tony001

修复应用数据异常

上级 8e4a44e3
......@@ -47,12 +47,19 @@ export const getLocalData = (state: any) => () => {
* @param state
*/
export const getAppData = (state: any) => () => {
if(!state.appdata){
state.appdata = {};
}
let result:any = JSON.parse(JSON.stringify(state.appdata));
let copyContext:any = result.context?result.context:{};
if(state.localdata && Object.keys(state.localdata).length >0){
Object.assign(copyContext,state.localdata);
}else if(localStorage.getItem('localdata')){
Object.assign(copyContext,JSON.parse(localStorage.getItem('localdata') as string));
try{
Object.assign(copyContext,JSON.parse(localStorage.getItem('localdata') as string));
}catch(error){
console.warn(error);
}
}
result.context = copyContext;
return result;
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册