fix: sortChildren broke SSR (#6046)

This commit is contained in:
neverland
2020-04-14 09:52:50 +08:00
committed by GitHub
parent 77f6b7a19a
commit 14c18c6b8b

View File

@@ -24,6 +24,11 @@ type VueInstance = {
// sort children instances by vnodes order
export function sortChildren(children: VueInstance[], parent: VueInstance) {
// null on SSR
if (!parent._vnode) {
return;
}
const vnodes = flattenVNodes(parent._vnode.children!);
children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode));
}