Javascript “其他国家”;更改“;用于聚合物中的单选按钮

Javascript “其他国家”;更改“;用于聚合物中的单选按钮,javascript,events,button,polymer-1.0,radio,Javascript,Events,Button,Polymer 1.0,Radio,我想有一组单选按钮,可以选择是显示法国地图还是世界地图。我的问题是,polymer官方文档仅将“更改”作为单选按钮状态的事件。因此,问题是,在我下面的当前代码中,单击不同的单选按钮将按预期工作,但单击已选择的单选按钮将触发此“更改”事件(我认为这是一种错误行为,因为按钮状态仍然是“已选择的”,没有更改。所以我的问题是:单选按钮状态是否还有其他事件?我尝试了“选中”、“选中”,但这些似乎都不起作用 这是我的密码: <div id="mapSelector"> <paper-rad

我想有一组单选按钮,可以选择是显示法国地图还是世界地图。我的问题是,polymer官方文档仅将“更改”作为单选按钮状态的事件。因此,问题是,在我下面的当前代码中,单击不同的单选按钮将按预期工作,但单击已选择的单选按钮将触发此“更改”事件(我认为这是一种错误行为,因为按钮状态仍然是“已选择的”,没有更改。所以我的问题是:单选按钮状态是否还有其他事件?我尝试了“选中”、“选中”,但这些似乎都不起作用

这是我的密码:

<div id="mapSelector">
<paper-radio-group id="mapSelectors" selected="radioWorld">
    <paper-radio-button id="radioFrance" name="radioFrance">France map</paper-radio-button>
    <paper-radio-button id="radioWorld" name="radioWorld">World map</paper-radio-button>
</paper-radio-group>
</div>

<div id="containerFrance" hidden="{{hideFrance}}" style="width: 800px; height: 600px;">
</div>

<div id="containerWorld" hidden="{{hideWorld}}" style="width: 800px; height: 600px;">
</div>



</template>

<script>
Polymer({
    is: 'page-maps',
    listeners: {
        'radioFrance.change': 'toggleMaps',
        'radioWorld.change': 'toggleMaps'
    },
    hideFrance: {
        type: Boolean,
        value: false
    },
    hideWorld: {
        type: Boolean,
        value: true
    },
    toggleMaps: function () {
        this.hideFrance = this.hideWorld;
        this.hideWorld = !this.hideWorld;
    }
});
</script>
</dom-module>

法国地图
世界地图
聚合物({
是:'页面地图',
听众:{
“radioFrance.change”:“toggleMaps”,
“radioWorld.change”:“toggleMaps”
},
隐藏:{
类型:布尔型,
值:false
},
隐藏世界:{
类型:布尔型,
值:true
},
切换映射:函数(){
this.hideFrance=this.hideWorld;
this.hideWorld=!this.hideWorld;
}
});

使用更改事件,然后检查回调中切换按钮的值,如下所示:

Polymer({
  is: 'page-maps',
  listeners: {
      'radioFrance.change': 'toggleMaps',
      'radioWorld.change': 'toggleMaps'
  },
  hideFrance: {
      type: Boolean,
      value: false
  },
  hideWorld: {
      type: Boolean,
      value: true
  },
  toggleMaps: function (e) {
      if(e.srcElement.value == false){
          //do some code
      }else{
          //do some other code
      }
  }
});