0

这是笨拙的

paper-tabs我的目标是iron-pagespaper-dialog.

当我单击第二个选项卡时,我希望看到选项卡式窗格的内容标题显示为“第 2 页”,然后是 Lorem Ipsum 文本。但是,相反,第二个选项卡式窗格内没有内容。

我错过了什么?

http://plnkr.co/edit/wyk9jb8cD4nufYQMI3L8?p=preview
<link href="tab-a.html" rel="import">
<link href="tab-b.html" rel="import">

<base href="https://polygit.org/polymer+:master/iron-data-table+Saulis+:master/components/">
<link rel="import" href="polymer/polymer.html">
<script src="webcomponentsjs/webcomponents-lite.min.js"></script>

<link rel="import" href="paper-dialog/paper-dialog.html">
<link rel="import" href="paper-tabs/paper-tabs.html">
<link rel="import" href="iron-pages/iron-pages.html">

<dom-module id="content-el">
    <template>
        <style></style>

    <button on-tap="open">Open Dialog</button>

    <paper-dialog id="dialog" modal>
      <h2>Dialog Title</h2>

      <paper-tabs selected="{{selected}}">
        <paper-tab>Tab 1</paper-tab>
        <paper-tab>Tab 2</paper-tab>
      </paper-tabs>

      <iron-pages selected="{{selected}}">
        <tab-a></tab-a>
        <tab-b></tab-b>
      </iron-pages>

    </paper-dialog>

    </template>

  <script>
    (function() {
      'use strict';
      Polymer({
        is: 'content-el',
        open: function() {
          this.$.dialog.open();
        },
      });
        })();
  </script>
</dom-module>
4

1 回答 1

2

预设选定的选项卡

否则,您paper-tabs将在没有预选选项卡的情况下进行初始化。

Polymer({
  is: 'content-el',
  properties: {
    selected: {
      type: Number,
      value: 0
    }
  },
  open: function() {
    this.$.dialog.open();
  }
});

修正您在tab-b声明中的拼写错误

Polymer({
  // was previously `tabb`
  is: 'tab-b'
});
于 2016-12-31T04:33:38.287 回答