使用 Object.defineProperty 定义 SetterGetter
var setValue;
var obj = {};
Object.defineProperty(obj, "objProperty", {
get: function(){
return "a value";
},
set: function(value){
setValue = value;
}
});
var setValue;
var obj = {};
Object.defineProperty(obj, "objProperty", {
get: function(){
return "a value";
},
set: function(value){
setValue = value;
}
});