提交 8e353dc4 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

sticky-section 示例 list-item v-for 添加 :key 不然在iOS平台动态添加数据可能会引起 list-item 顺序错乱

上级 9da6a971
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
<list-item style="padding: 10px; margin: 5px 0;align-items: center;" :type = 20> <list-item style="padding: 10px; margin: 5px 0;align-items: center;" :type = 20>
<button @click="appendSectionItem(0)" size="mini">A section 新增5条内容</button> <button @click="appendSectionItem(0)" size="mini">A section 新增5条内容</button>
</list-item> </list-item>
<sticky-section v-for="(section) in sectionArray" :padding="sectionPadding" :push-pinned-header="true"> <sticky-section v-for="(section) in sectionArray" :key="section.name" :padding="sectionPadding" :push-pinned-header="true">
<sticky-header :id="section.name"> <sticky-header :id="section.name">
<text class="sticky-header-text">{{section.name}}</text> <text class="sticky-header-text">{{section.name}}</text>
</sticky-header> </sticky-header>
<list-item v-for="(list) in section.list" class="content-item" :type=10> <list-item v-for="(list) in section.list" :key="list.text" :name="list.text" class="content-item" :type=10>
<text class="text">{{list.text}}</text> <text class="text">{{list.text}}</text>
</list-item> </list-item>
</sticky-section> </sticky-section>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册