0
<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不会将单击转发到单选按钮,但文档说:所有点击iron-label都将转发到“目标”元素。

4

1 回答 1

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,控制台,输出

于 2016-06-14T23:57:44.360 回答