//Properties
drivingEligibility:{type:Boolean,notify:true}
//EventListener
driving(){
if (this.$.drivingEligibility.checked == true) {this.drivingEligibility = true;
console.log(" drivingEligibility.value in if :" +this.drivingEligibility);
}else{
this.drivingEligibility = false;
console.log(" drivingEligibility.value in else :" +this.drivingEligibility);
}
}
HTML Code
<paper-toggle-button name="drivingEligibility" id="drivingEligibility" class="float-right" checked="{{drivingEligibility}}" on-change="driving"></paper-toggle-button>
数据以正确的格式保存。.但数据未绑定到元素(纸张切换按钮)
答案 0 :(得分:0)
您不需要在函数中设置drivingEligibility
的值。它已经绑定。在:
<paper-toggle-button name="drivingEligibility" id="drivingEligibility" class="float-right" checked="{{drivingEligibility}}" on-change="driving"></paper-toggle-button>