如何处理霓虹灯可动画的'页面动画在Polymer 1.0中完成?

时间:2015-09-03 16:21:09

标签: polymer polymer-1.0

选择neon-animatable页后,是否存在页面动画完成事件的处理程序?我在此处使用的_onNeonAnimationFinish方法仅处理dom-module容器的动画完成事件。

模板摘录:

<neon-animated-pages class="fit" selected="{{selectedPage}}" attr-for-selected="id" entry-animation="slide-from-right-animation" exit-animation="slide-left-animation" on-iron-select="_pageChanged">
    <neon-animatable id="page1" class="fit">1</neon-animatable>
    <neon-animatable id="page2" class="fit">2</neon-animatable>
    <neon-animatable id="page3" class="fit">3</neon-animatable>
</neon-animated-pages>

脚本:

Polymer({
  is: "popup-view",

  behaviors: [
      Polymer.PaperDialogBehavior,
      Polymer.NeonAnimationRunnerBehavior
    ],

  listeners: {
    'neon-animation-finish': '_onNeonAnimationFinish'
  },

  _onNeonAnimationFinish: function() {
    console.log("*** _onNeonAnimationFinish ***"); // only called when container animation completes
    if (this.opened) {
      this._finishRenderOpened();
    } else {
      this._finishRenderClosed();
    }
  },

1 个答案:

答案 0 :(得分:3)

尝试将事件处理程序添加到<neon-animated-pages>元素。

<neon-animated-pages on-neon-animation-finish="_onNeonAnimationFinish" ...