Upgrading to Polymer 1.0, How do I listen/capture to change in "focusedItem" of iron-menu-behaviour? I cannot see any event or property change listener for an item change i.e. change in paper-item selection within a paper-menu. I cannot see any such events here: https://elements.polymer-project.org/elements/iron-menu-behavior?active=Polymer.IronMenuBehavior
相关问题
- How can I dynamically add items into paper-dropdow
- How can I dynamically add items into paper-dropdow
- 2 way data-binding between a polymer component and
- Shadow DOM CSS Styling from outside is not working
- How to get Polymer 2.0 ES5 elements working with v
相关文章
- Access shadow DOM properties (polymer) with javasc
- document.querySelector() returns null
- Updating Polymer component via Websocket?
- polymer duplicate element content
- Where is it best to handle the business logic in m
- How do you bind Polymer elements to a Model in ASP
- Polymer 2.0: Notify and reflect to attribute
- Polymer paper-dialog position
I find that people often love to overcomplicate things when dealing with Polymer. Here's a simple approach:
JS
HTML
I have not been able to find any documentation on this just yet (perhaps someone else may have better luck), but the events you are looking for are
iron-select
andiron-deselect
. Both of these events use the handler format:eventHandler(e, details)
, in which:e
is theCustomEvent
.details
is an object with anitem
property pointing to the element that was selected or deselected.I've set up a demo on Plunker that you can play around with. It has a sample menu and will log both
e
anddetails
from bothiron-select
andiron-deselect
events to the console.That being said, however, if you are able to avoid using the event and instead use bindings, I would recommend that route first. If this is within a custom element, you could, for example, do:
There is a on-iron-select.
So you can do
Script
But there is no doc about this,here is the line when the event is fired.