on-core-animated-pages-transition-end 函数

on-core-animated-pages-transition-end function

我在我的应用中使用了两个 "core-animated-page" 一个用于页面导航,另一个用于

我想在 on-core-animated-pages-transition-end 时加载子元素的内容,但是它在两个 core-animated-pages 中都触发了

<core-animated-pages id="pages" on-core-animated-pages-transition-end="{{loadproductsgrid}}" selected="{{route}}" valueattr="hash" transitions="slide-from-right">
    <template repeat="{{page, i in pages}}">
     <section hash="{{page.hash}}" layout="vertical center-center "> 
      </section>
        </template>
 </core-animated-pages>

如何将其限制为一个元素

当该事件被触发并调用该函数时,您可以检查事件目标 ID 的 ID 以查看哪个元素发送了该事件

loadproductsgrid: function (event) {
  if (event.target.id === 'pages') {
    // will only fire if pages is the sending element 
  }
}

希望对您有所帮助