我想为Polymer paper-dropdown-menu
提供一组动态项目。我可以显示动态项目,但点击它们什么都不做。
查看:
<paper-dropdown-menu label="Your favourite pastry">
<paper-menu class="dropdown-content" selected.two-way="favPastry" attr-for-selected="value">
<!-- Begin works when selected -->
<paper-item value="Croissant">Croissant</paper-item>
<paper-item value="Donut">Donut</paper-item>
<paper-item value="Financier">Financier</paper-item>
<paper-item value="Madeleine">Madeleine</paper-item>
<!-- End works when selected -->
<!-- Begin does not work when selected -->
<paper-item repeat.for="pastry of pastries" value="${pastry}">${pastry}</paper-item>
<!-- End does not work when selected -->
</paper-menu>
</paper-dropdown-menu>
查看模型:
pastries = [ "Bear Claw", "Pie" ];
favPastry = "Donut";
如何在Aurelia应用程序中向paper-dropdown-menu
提供动态的项目列表?
答案 0 :(得分:0)
要从数组中创建paper-item
,您必须使用<template is="dom-repeat">
,如下所述:https://www.polymer-project.org/1.0/docs/devguide/templates.html#dom-repeat