首页 > 解决方案 > 使用 bind-for 创建的项目在从绑定数组/列表中删除时不会消失

问题描述

当我更新列表时,在前一个列表中有键的项目变得不可见,但它们仍然占用空间。如果它发生变化,是否可以强制 aframe 完全重新构建列表?

我的代码:

<a-entity id="menuDifficulties" bind-for="for: item; in: menuDifficulties; key: id; updateInPlace: true; pool: 10"
        bind__visible="!!menuSelectedChallenge.id" layout="type: box; columns: 1; marginRow: -0.2;" position="0 0.34 0"
        menu-difficulty-select>
        {% raw %}
        <template>
          <!-- Item is a string representing the difficulty. -->
          <a-entity class="difficultyOption" bind-item__data-id="item.id">
            <!-- Text and UI -->
          </a-entity>
        </template>
        {% endraw %}
</a-entity>

我认为这个问题是由 引起的updateInPlace: true,但是将其设置为false列表时根本不会呈现。bind-for我在官方文档中找不到任何信息。

标签: aframe

解决方案


推荐阅读