在聚合物入門套件上展開我很努力想知道當不同的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
解決我對這個元素的問題就夠了。說實話,我並沒有考慮如何向每個圖標添加轉換,但是您可以意識到有一個監聽器可以爲相應的圖標執行操作,只需要向監聽器添加額外的功能,嗯,我認爲是這樣。順便說一句,我的英語很抱歉。 –