Skip to content

Commit 05d4a4e

Browse files
committed
general fix for all v-for v-bind:key issues
1 parent bbcb9b9 commit 05d4a4e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/functions.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function forAttr(el, val, item = 'item', remove = true) {
2828
}
2929

3030
el.attr('v-for', `(${item}, i) in ${val}`)
31-
el.attr(':key', 'item.path || i')
31+
el.attr(':key', `${item}.path || i`)
3232
}
3333

3434
/**
@@ -136,8 +136,8 @@ const f = {
136136
*/
137137
addChildren($) {
138138
$.append(
139-
`<template v-for="child in model.children">
140-
<component v-bind:is="child.component" v-bind:model="child"></component>
139+
`<template v-for="(child, i) in model.children">
140+
<component v-bind:key="child.path || i" v-bind:is="child.component" v-bind:model="child"></component>
141141
</template>`)
142142
},
143143

0 commit comments

Comments
 (0)