Skip to content
This repository was archived by the owner on Jan 19, 2023. It is now read-only.
This repository was archived by the owner on Jan 19, 2023. It is now read-only.

使用repeat循环渲染时,无法直接给元素绑定key值 #7

@GeniusFunny

Description

@GeniusFunny

在设计组件时为保证可拓展性,打算由page获取数据后将数据传递给组件Menu,Menu拿到数据后,使用repeat标签循环渲染时,无法为各个元素绑定key值。暂时的解决方法是:为元素绑定id
child.wpy

<repeat for="{{menuList}}" item="item">
  <li class="item" @tap="click" id="{{item.unique}}">
    {{item.value}}
  </li>
</repeat>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions