mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix: sortChildren broke SSR (#6046)
This commit is contained in:
parent
77f6b7a19a
commit
14c18c6b8b
@ -24,6 +24,11 @@ type VueInstance = {
|
|||||||
|
|
||||||
// sort children instances by vnodes order
|
// sort children instances by vnodes order
|
||||||
export function sortChildren(children: VueInstance[], parent: VueInstance) {
|
export function sortChildren(children: VueInstance[], parent: VueInstance) {
|
||||||
|
// null on SSR
|
||||||
|
if (!parent._vnode) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const vnodes = flattenVNodes(parent._vnode.children!);
|
const vnodes = flattenVNodes(parent._vnode.children!);
|
||||||
children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode));
|
children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user