From bad69d9f3f8b8eb74cb774a4cfb925e0500ab340 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 5 Jul 2020 17:06:37 +0800 Subject: [PATCH] chore: remove sortChildren --- src-next/mixins/relation.js | 4 ---- src-next/utils/vnodes.ts | 34 ---------------------------------- 2 files changed, 38 deletions(-) delete mode 100644 src-next/utils/vnodes.ts diff --git a/src-next/mixins/relation.js b/src-next/mixins/relation.js index b3f6cb37e..0e65df6b3 100644 --- a/src-next/mixins/relation.js +++ b/src-next/mixins/relation.js @@ -1,5 +1,3 @@ -import { sortChildren } from '../utils/vnodes'; - export function ChildrenMixin(parent, options = {}) { const indexKey = options.indexKey || 'index'; @@ -44,8 +42,6 @@ export function ChildrenMixin(parent, options = {}) { const children = [...this.parent.children, this]; - sortChildren(children, this.parent); - this.parent.children = children; }, }, diff --git a/src-next/utils/vnodes.ts b/src-next/utils/vnodes.ts deleted file mode 100644 index 34cc6bf37..000000000 --- a/src-next/utils/vnodes.ts +++ /dev/null @@ -1,34 +0,0 @@ -// import { VNode } from 'vue'; - -// function flattenVNodes(vnodes: VNode[]) { -// const result: VNode[] = []; - -// function traverse(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); -// } -// }); -// } - -// traverse(vnodes); -// return result; -// } - -// TODO -// sort children instances by vnodes order -export function sortChildren(children: Vue[], parent: Vue) { - // const { componentOptions } = parent.$vnode; - // if (!componentOptions || !componentOptions.children) { - // return; - // } - - // const vnodes = flattenVNodes(componentOptions.children); - // children.sort((a, b) => vnodes.indexOf(a.$vnode) - vnodes.indexOf(b.$vnode)); -}