聚合物1.x:霓虹灯动画页面在纸张标签和纸张对话框中不起作用

时间:2016-12-31 06:50:37

标签: polymer polymer-1.0 paper-elements polymer-1.x neon-animation

文字落在对话框之外

Text falls outside dialog

Here is the plunk

我想在neon-animated-pages内实施由paper-tabs控制的paper-dialog

我希望tab-a中包含tab-bpaper-dialog的内容,但内容会溢出到paper-dialog之外。

我错过了什么?

http://plnkr.co/edit/bPUclBOpghNFVmKMbOzc?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">
<link rel="import" href="neon-animation/neon-animation.html">
<link rel="import" href="neon-animated-pages/neon-animated-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>

      <neon-animated-pages selected="{{selected}}">
        <tab-a entry-animation="slide-from-left-animation"
               exit-animation="slide-left-animation"
        ></tab-a>
        <tab-b entry-animation="slide-from-right-animation"
               exit-animation="slide-right-animation"
        ></tab-b>
      </neon-animated-pages>

    </paper-dialog>

    </template>

  <script>
    (function() {
      'use strict';
      Polymer({
        is: 'content-el',

                behaviors: [
                    Polymer.NeonAnimationRunnerBehavior,
                    Polymer.NeonAnimatableBehavior,
                    Polymer.IronResizableBehavior,
                ],

        properties: {
          selected: {
            type: Number,
            value: 0
          }
        },
        open: function() {
          this.$.dialog.open();
        },
      });
        })();
  </script>
</dom-module>

1 个答案:

答案 0 :(得分:2)

非对话内容位于<neon-animated-pages>内,检查<neon-animated-pages>显示其没有高度:

enter image description here

要解决此问题,请将CSS样式应用于<paper-dialog><neon-animated-pages>以设置其宽度/高度;并在页面上设置overflow以允许滚动。例如:

<dom-module id="content-el">
<template>
  <style>
    paper-dialog {
      width: 75%;
      min-width: 50vw;
    }
    neon-animated-pages {
      margin: 2em;
      height: 100%;
      min-height: 25vh;
      overflow: auto;
    }
  </style>
  ...
</template>
</dom-module>

plunker