Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
403 views
in Technique[技术] by (71.8m points)

polymer-3.x - Polymer-3.x ..无法通过对象引用从JSON绑定值到paper-toggle-button(Polymer-3.x.. Can't able to bind value from the JSON through object reference to the paper-toggle-button)

 //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> 

Data is saving in the correct format.. but data is not binding to the element(paper-toggle-button)

(数据以正确的格式保存..但数据未绑定到元素(纸张切换按钮))

  ask by mounika translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You do not need to set the value of drivingEligibility in function.

(您无需在函数中设置drivingEligibility的值。)

Its already bound.

(它已经绑定。)

At:

(在:)

<paper-toggle-button name="drivingEligibility" id="drivingEligibility" class="float-right" checked="{{drivingEligibility}}" on-change="driving"></paper-toggle-button>

Demo

(演示版)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...