Match-id-e4196e9fd763be3e06cc2c404f9780e4664daff7

This commit is contained in:
* 2022-09-07 17:42:28 +08:00 committed by *
parent ec83aff5e6
commit b55f7c4f22
1 changed files with 2 additions and 1 deletions

View File

@ -70,7 +70,8 @@ function checkCanReuseNode(oldNode: VNode | null, newChild: any, newNodeIdx: num
return oldKey === null;
}
if (newChild.vtype === TYPE_COMMON_ELEMENT || newChild.vtype === TYPE_PORTAL) {
if(oldKey || newChild.key) {
// key存在时用key判断复用
if (oldKey != null || newChild.key != null) {
return oldKey === newChild.key;
} else {
// 新旧节点的index应该相同才能复用null会影响位置