关于 https://vue3js.cn/es6/ 相关代码
chengazhen opened this issue · 2 comments
chengazhen commented
相关问题我写在了代码里面
const target = {
_id: '1024',
name: 'vuejs'
}
const proxy = new Proxy(target, {
get(target, propkey, proxy){
if(propkey[0] === '_'){
throw Error(`${propkey} is restricted`)
}
return Reflect.get(target, propkey, proxy) //这里target将会被改为 { name: [Circular], _id: '1024' },相当于改变了target,不理解这
一步是需要产生什么效果呢,如果不做任何操作也可以成功打印出来("vuejs")
},
set(target, propkey, value, proxy){
if(propkey[0] === '_'){
throw Error(`${propkey} is restricted`)
}
return Reflect.get(target, propkey, value, proxy)
}
})
chengazhen commented
febobo commented