Object.defineProperty()使用示例 最后更新时间:2024年08月27日 ```python let upload_var = { "_upload_sw":0, }; // 1 为开启可以上传文件 0为关闭不能上传文件 Object.defineProperty(upload_var,'upload_sw', { configurable:true, set:function(newVal){ this._upload_sw = newVal; if(newVal == 1){ let submit_button = getIDD("submit_button") submit_button.className="upload_button" console.log('set:'+this._type) }else if(newVal == 0){ let submit_button = getIDD("submit_button") submit_button.className="not_submit_button" } }, get:function(){ return this._upload_sw } }) ```
Comments | NOTHING