Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 9b30527

Browse files
committed
修复使用index作为v-for的key
1 parent 02c8872 commit 9b30527

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/components/page/DragList.vue

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
<div class="item-title">todo</div>
1717
<draggable v-model="todo" @remove="removeHandle" :options="dragOptions">
1818
<transition-group tag="div" id="todo" class="item-ul">
19-
<div v-for="(item,index) in todo" class="drag-list" :key="index">
19+
<div v-for="item in todo" class="drag-list" :key="item.id">
2020
{{item.content}}
2121
</div>
2222
</transition-group>
@@ -26,7 +26,7 @@
2626
<div class="item-title">doing</div>
2727
<draggable v-model="doing" @remove="removeHandle" :options="dragOptions">
2828
<transition-group tag="div" id="doing" class="item-ul">
29-
<div v-for="(item,index) in doing" class="drag-list" :key="index">
29+
<div v-for="item in doing" class="drag-list" :key="item.id">
3030
{{item.content}}
3131
</div>
3232
</transition-group>
@@ -36,7 +36,7 @@
3636
<div class="item-title">done</div>
3737
<draggable v-model="done" @remove="removeHandle" :options="dragOptions">
3838
<transition-group tag="div" id="done" class="item-ul">
39-
<div v-for="(item,index) in done" class="drag-list" :key="index">
39+
<div v-for="item in done" class="drag-list" :key="item.id">
4040
{{item.content}}
4141
</div>
4242
</transition-group>
@@ -61,34 +61,43 @@
6161
},
6262
todo: [
6363
{
64+
id: 1,
6465
content: '开发图表组件'
6566
},
6667
{
68+
id: 2,
6769
content: '开发拖拽组件'
6870
},
6971
{
72+
id: 3,
7073
content: '开发权限测试组件'
7174
}
7275
],
7376
doing: [
7477
{
78+
id: 1,
7579
content: '开发登录注册页面'
7680
},
7781
{
82+
id: 2,
7883
content: '开发头部组件'
7984
},
8085
{
86+
id: 3,
8187
content: '开发表格相关组件'
8288
},
8389
{
90+
id: 4,
8491
content: '开发表单相关组件'
8592
}
8693
],
8794
done:[
8895
{
96+
id: 1,
8997
content: '初始化项目,生成工程目录,完成相关配置'
9098
},
9199
{
100+
id: 2,
92101
content: '开发项目整体框架'
93102
}
94103
]

0 commit comments

Comments
 (0)