【问题标题】:vaadin combobox in polymer 3聚合物 3 中的 vaadin 组合框
【发布时间】:2022-06-10 20:37:08
【问题描述】:

我有以下代码在聚合物 3 中使用 vaadin 组合框,但它不起作用。

<vaadin-combo-box id ="select" placeholder="Please select">
  <template is="dom-repeat" items="{{items}}" as="item">
  <option value$="{{item.id}}">&nbsp;&nbsp;{{item.type}}</option>
</vaadin-combo-box>

我明白,它与 and 有关,否则如果我只在项目中使用精确值,它就可以工作

【问题讨论】:

    标签: combobox vaadin14 polymer-3.x


    【解决方案1】:

    只是猜测,但您可能想使用{{this.items}} 而不是{{items}}

    【讨论】:

      【解决方案2】:

      您不应将templatedom-repeat 一起使用。有基于 items 属性使用vaadin-item 填充弹出窗口的内部逻辑(注意,它不使用option),所以如果你这样做应该就足够了

      <vaadin-combo-box
        label="Type"
        placeholder="Please select"
        item-label-path="type"
        item-value-path="id"
        items="{{this.items}}"
      ></vaadin-combo-box>
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2016-02-09
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多