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