<iron-label>没有转发到<paper-radio-button>

时间:2016-06-14 15:37:39

标签: polymer paper-elements iron-elements

<div class="center horizontal layout">
      <iron-label>
        paper radio button
        <paper-radio-button noink iron-label-target>Radio</paper-radio-button>
      </iron-label>
</div>

点击文字paper radio button而不是将点击转到单选按钮,但documentation说:iron-label上的所有点按都会转发到&#34;目标&#34;元件。

1 个答案:

答案 0 :(得分:2)

我在这个JS Bin工作。

<!doctype html>
<html>

<head>
  <meta name="description" content="http://stackoverflow.com/questions/37816458">
  <meta charset="utf-8">
  <base href="http://polygit.org/components/">
  <script href="webcomponentsjs/webcomponents-lite.min.js"></script>
  <link href="polymer/polymer.html" rel="import">
  <link href="iron-label/iron-label.html" rel="import">
  <link href="paper-radio-button/paper-radio-button.html" rel="import">
</head>

<body>
  <dom-module id="my-el">
    <template>
      <iron-label>
        clicking here should forward tap to paper-radio-button
        <paper-radio-button noink iron-label-target on-tap="radioButtonTapped">Radio</paper-radio-button>
      </iron-label>
    </template>
    <script>
      Polymer({
        is: 'my-el',
        radioButtonTapped: function (e) {
          console.log('tap');
        }
      });
    </script>
  </dom-module>
  <my-el></my-el>
</body>

</html>

https://jsbin.com/juzewi/edit?html,console,output