问题来源
let upload_var = {
"upload_sw":0
}; // 1 为开启可以上传文件 0为关闭不能上传文件
Object.defineProperty(upload_var,'upload_sw', {
configurable:true,
value:0,
set:function(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(){
console.log('get:'+this._upload_sw)
return this.value
}
})解决方法
在使用Object.defineProperty() 定义对象属性的时候,如果设置了 set 或 get, 就不能设置 writable 和 value 中的任何一个



Comments | NOTHING