在聚合物入门套件上展开我很努力想知道当不同的iron-page
处于活动状态时,如何将汉堡包(menu
)图标更改为不同的按钮。聚合物 - 根据选定的熨斗更改纸张 - 工具栏内容
的index.html
<paper-toolbar class="paper-toolbar-0" id="mainToolbar">
<paper-icon-button id="paperToggle" icon="menu" paper-drawer-toggle></paper-icon-button>
<!-- more toolbar content here -->
</paper-toolbar>
<iron-pages attr-for-selected="data-route" class="layout vertical center" selected="{{route}}">
<!-- Top Stories -->
<section data-route="topstories">
<story-list id="story-list" class="layout vertical center-justified"></story-list>
</section>
<!-- Item Info -->
<section data-route="item-info" class="fullbleed layout center-justified">
<item-info firebase-item-id="[[params.firebaseitemid]]" class="fullbleed flex"></item-info>
</section>
</iron-pages>
当选择item-info
路线,我想用back
按钮来替换menu
paper-toggle-button
。可能将工具栏文本从应用程序标题更改为“返回顶部故事”。
现在,我认为通过在这些控件上设置一个id
,然后在做出这些更改的item-info
元素中包含一些Javascript。我更喜欢一些更模块化的东西,因为这会将我的item-info
元素与其外部的内容非常接近。
整洁的想法 - 当你需要在不同的图标之间循环时,我可以看到这一点。你将如何处理它们之间的转换?很高兴能够做一个像YouTube播放按钮转换到暂停按钮一个很好的过渡。 – Insectatorious
解决我对这个元素的问题就够了。说实话,我并没有考虑如何向每个图标添加转换,但是您可以意识到有一个监听器可以为相应的图标执行操作,只需要向监听器添加额外的功能,嗯,我认为是这样。顺便说一句,我的英语很抱歉。 –