解决 值为null问题 #236

Merged
zhengdegang merged 1 commits from zdg into main 2024-09-20 15:06:34 +08:00
1 changed files with 1 additions and 1 deletions
Showing only changes of commit ca57e72e9c - Show all commits

View File

@ -61,7 +61,7 @@ function stateSyncWatch(storeName, newState) {
// console.log('state-change-diffData', diffData)
try {
for(const key in diffData) {
const value = diffData[key]
const value = diffData[key] || null
const newValue = {} // 重新组装pinia需要的数据 {a:{b:1}} 这种
const keyArr = key.split('.') || []
keyArr.reduce((o,c,i)=>{o[c] = i === keyArr.length-1 ? value : {};return o[c]}, newValue)