写了个代理发现 赋值 proxy.a = xxx的时候能响应到,但是proxy.o.aa = 2222就响应不到了,需要写个递归处理下,不会能帮忙写下代码吗?
const proxy = new Proxy({ a: 1, o: { aa: 1, bb: 2 } }, {
get(target, key, receiver) {
return Reflect.get(target, key, receiver);
},
set(target, key, value, receiver) {
console.log(3333);
return Reflect.set(target, key, value, receiver);
},
})
这样试试