聚合物3中的vaadin Combox

发布于 2025-02-05 03:28:45 字数 343 浏览 1 评论 0原文

我有以下代码在聚合物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>

我明白,它与此有关,否则,如果我只使用项目中的准确值,它就有效

I have following code to use vaadin combo box in polymer 3, but itis not working.

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

I understand, it has to do with and , else if I just use exact values in items, it works

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

泪之魂 2025-02-12 03:28:46

您不应将模板dom-repeat一起使用。有内部逻辑可以基于项目属性的vaadin-item s填充弹出窗口(注意,它不使用option),因此如果您执行

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

You should not use template with dom-repeat. There is internal logic that populates the popup with vaadin-item's based on items property (note, it does not use option), so it should be enough if you do

<vaadin-combo-box
  label="Type"
  placeholder="Please select"
  item-label-path="type"
  item-value-path="id"
  items="{{this.items}}"
></vaadin-combo-box>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文