web component - Polymer2.0 - Trying to change webcomponent attribute value by binding value from paper-input -
i trying control attribute value of webcomponent polymer paper input.
i able change values 2 binding of paper input not able control attribute value
i created below example , trying change resizable-panels attribute vertical
<resizable-panels [[text]]> to
<resizable-panels vertical> using paper-input
codepen code reference https://codepen.io/nagasai/pen/qmjjqw
html:
<head> <base href="https://polygit.org/polymer+v2.0.0/shadycss+webcomponents+1.0.0/components/"> <link rel="import" href="polymer/polymer.html"> <link rel="import" href="resizable-panels/resizable-panels.html"> <link rel="import" href="paper-input/paper-input.html" </head> <body> <x-foo></x-foo> <dom-module id="x-foo"> <template> <style> .panel { padding: 20px; color: white; font-family: sans-serif; width: 50%; } .p1 { background-color: #673ab7; } .p2 { background-color: #e91e63; } .p3 { background-color: #00bcd4; } .p4 { background-color: #fb8c00; } .p5 { background-color: #607d8b; } .p6 { background-color: #4caf50; } </style> <paper-input value="{{text::input}}"></paper-input> <resizable-panels id="rp-2"> <div class="panel p1">lorem ipsum dolor…</div> <div class="panel p2">second panel</div> </resizable-panels> <br> <resizable-panels [[text]]> <div class="panel p1">lorem ipsum dolor…</div> <div class="panel p1">second panel</div> <div class="panel p1">third panel</div> </resizable-panels> </template> </dom-module> </body> js:
class xfoo extends polymer.element { static is() { return 'x-foo'; } static properties() { return {}; } toggle() { this.$.collapse.toggle(); } } customelements.define(xfoo.is, xfoo);
thats not how supposed work, cant slap tag , expect work - since not server side building - not supposed treat templates this.
here working demo: https://codepen.io/anon/pen/rzogqx
you should toggling boolean property vertical between true/false archieve want. hope helps.
Comments
Post a Comment