<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<script type="text/javascript" src="../js/vue.js"></script>
</head>
<body>
<script type="text/javascript">
Vue.config.productionTip= false;

let number = 18;
let person = {
name:'张三',
sex: '男',
};

Object.defineProperty(person,'age',{
//value:18,
//enumerable : true, //属性可以被枚举
//writable :true, //属性可编辑
//configurable: true,// 属性可删除

//当有人读取person对象的age属性时,调用此函数,
get:function () {
console.log('有人读取age属性了');
return number;
},

set(value){
console.log('有人设置了age属性');
number = value;
}
});

console.log(Object.keys(person));

console.log(person);
</script>
</body>
</html>