refactor(web): 优化节点展现

This commit is contained in:
v-zhangjc9
2025-07-10 12:44:37 +08:00
parent 5e763637da
commit f707a0d2b5
7 changed files with 202 additions and 145 deletions

View File

@@ -6,6 +6,7 @@ export type DataStoreState = {
setData: (data: Record<string, any>) => void,
getDataById: (id: string) => any,
setDataById: (id: string, data: any) => void,
mergeDataById: (id: string, data: any) => void,
}
export const useDataStore = create<DataStoreState>((set, get) => ({
@@ -22,4 +23,14 @@ export const useDataStore = create<DataStoreState>((set, get) => ({
data: updateData,
})
},
mergeDataById: (id, data) => {
let updateData = get().data
updateData[id] = {
...(updateData[id] ?? {}),
...data,
}
set({
data: updateData,
})
},
}))