fix: 修复清空父应用状态,子应用状态未清空问题 (#251)

This commit is contained in:
听海 2024-10-12 10:12:25 +08:00 committed by GitHub
parent ba04e97fa7
commit 57d9df85d0

View File

@ -3,9 +3,12 @@ import { cloneDeep } from 'lodash-es'
let initState = reactive({});
const setModelState = (props) => {
// 使用深拷贝去掉主应用数据和子应用数据的引用关系,避免出现副作用。
Object.keys(initState).forEach(p=>{
delete initState[p]
})
Object.assign(initState, cloneDeep(props))
};
export default () => initState;
export { setModelState };
export { setModelState };