基本的例子
<script src='bower_components/webcomponentsjs/webcomponents-lite.min.js'></script>
<link rel='import' href='bower_components/polymer/polymer.html'>
<link rel='import' href='bower_components/paper-button/paper-button.html'>
<link rel='import' href='bower_components/paper-input/paper-input.html'>
<dom-module id='toggle-attribute'>
<template>
<style>
</style>
<paper-input id='input'></paper-input>
<paper-button on-tap='_toggle'>Tap me</paper-button>
</template>
</dom-module>
<script>
Polymer({
is:'toggle-attribute',
properties:{
isTrue:{
type:Boolean,
value:false
}
},
_toggle:function(){
this.isTrue = !this.isTrue;
this.toggleAttribute('disabled',this.isTrue,this.$.input);
}
})
</script>
这是一个跑步者