fix: incorrect vnode order in some cases (#6140)

This commit is contained in:
neverland
2020-04-26 21:40:44 +08:00
committed by GitHub
parent 50a4dc681c
commit 7102129601
4 changed files with 49 additions and 6 deletions
+5 -5
View File
@@ -7,6 +7,10 @@ function flattenVNodes(vnodes: VNode[]) {
vnodes.forEach((vnode) => {
result.push(vnode);
if (vnode.componentInstance) {
traverse(vnode.componentInstance.$children.map((item) => item.$vnode));
}
if (vnode.children) {
traverse(vnode.children);
}
@@ -17,12 +21,8 @@ function flattenVNodes(vnodes: VNode[]) {
return result;
}
type VueInstance = {
$vnode: VNode;
};
// sort children instances by vnodes order
export function sortChildren(children: VueInstance[], parent: VueInstance) {
export function sortChildren(children: Vue[], parent: Vue) {
const { componentOptions } = parent.$vnode;
if (!componentOptions || !componentOptions.children) {
return;