<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
//被代理对象
let obj = {
name: "John",
}
//代理对象
let objProxy={
age:20
}
//Object.setPrototypeOf(objProxy,obj)
Object.defineProperty(objProxy,"name",{
get(){
return obj.name
},
set(value){
obj.name=value
}
})
</script>
</body>
</html>
标签:objProxy,obj,浅谈,Object,代理,数据,name
From: https://www.cnblogs.com/zy8899/p/18440068