Skip to content

Commit 15193cf

Browse files
committed
fix:nested elements can not be updated correctly
1 parent ca02043 commit 15193cf

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/core/instance/render-helpers/render-list.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* @flow */
22

3-
import { isObject } from 'core/util/index'
3+
import { isObject, isDef } from 'core/util/index'
44

55
/**
66
* Runtime helper for rendering v-for lists.
@@ -28,5 +28,8 @@ export function renderList (
2828
ret[i] = render(val[key], key, i)
2929
}
3030
}
31+
if (isDef(ret)) {
32+
(ret: any)._isVList = true
33+
}
3134
return ret
3235
}

src/core/vdom/helpers/normalize-children.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* @flow */
22

33
import VNode, { createTextVNode } from 'core/vdom/vnode'
4-
import { isFalse, isDef, isUndef, isPrimitive } from 'shared/util'
4+
import { isFalse, isTrue, isDef, isUndef, isPrimitive } from 'shared/util'
55

66
// The template compiler attempts to minimize the need for normalization by
77
// statically analyzing the template at compile time.
@@ -45,7 +45,8 @@ function normalizeArrayChildren (children: any, nestedIndex?: string): Array<VNo
4545
last = res[res.length - 1]
4646
// nested
4747
if (Array.isArray(c)) {
48-
res.push.apply(res, normalizeArrayChildren(c, `${nestedIndex || ''}_${i}`))
48+
const subIndex = isTrue(c._isVList) ? `${nestedIndex || ''}_${i}` : undefined
49+
res.push.apply(res, normalizeArrayChildren(c, subIndex))
4950
} else if (isPrimitive(c)) {
5051
if (isDef(last) && isDef(last.text)) {
5152
last.text += String(c)

0 commit comments

Comments
 (0)