如何在脚手架工具栏中实现下拉列表? 我正在尝试
<template is="auto-binding">
<div relative tool>
<core-icon-button id="sonst" icon="more-vert"></core-icon-button>
<core-dropdown relatedTarget="{{$.sonst}}" halign="right" valign="top">
<core-menu>
<core-item>Einstellungen</core-item>
<core-item>Hilfe</core-item>
<core-item>Impressum</core-item>
</core-menu>
</core-dropdown>
</div>
</template>
图标按钮显示在工具栏中,但下拉菜单未点亮。
答案 0 :(得分:0)
我觉得太简单了。另一位开发人员指出了我的解决方案。谢谢迈克尔。
使用“on-tap”和“this。$。drop.toggle()” 或变量opens =“{{opened}}”
<polymer-element name="x-test" >
<template>
<div relative tool>
<core-icon-button id="sonst" icon="more-vert" on-tap="{{toggle}}"></core-icon-button>
<core-dropdown id="drop" opened="{{opened}}" relatedtarget="{{$.sonst}}" halign="left" valign="top">
<core-menu>
<core-item>Einstellungen</core-item>
<core-item>Hilfe</core-item>
<core-item>Impressum</core-item>
</core-menu>
</core-dropdown>
</div>
</template>
<script>
Polymer({
toggle: function() {
this.$.drop.toggle();
//this.opened = !this.opened;
}
});