mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
types: improve vnode utils typing
This commit is contained in:
parent
b8dea3c13b
commit
36dbf0c4e0
@ -18,8 +18,13 @@ function flattenVNodes(vnodes: VNode[]) {
|
||||
return result;
|
||||
}
|
||||
|
||||
type VueInstance = {
|
||||
_vnode: VNode;
|
||||
$vnode: VNode;
|
||||
};
|
||||
|
||||
// sort children instances by vnodes order
|
||||
export function sortChildren(children: any[], parent: any) {
|
||||
const vnodes = flattenVNodes(parent._vnode.children);
|
||||
export function sortChildren(children: VueInstance[], parent: VueInstance) {
|
||||
const vnodes = flattenVNodes(parent._vnode.children!);
|
||||
children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user