更新时间:2022-05-10 21:20:20
var fence= {
set x1(){
alert('change');
this.rebuild();
},
rebuild: function(){}
}
还
function Fence(val){
var value = val;
this.__defineGetter__("x1", function(){
return value;
});
this.__defineSetter__("x1", function(val){
alert('change');
this.rebuild();
});
this.rebuild = function(){};
}
var fence = new Fence();