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

This commit is contained in:
听海 2024-10-12 10:12:25 +08:00 committed by GitHub
parent 314dc2133b
commit df36be4671
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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 };