/**
 * @desc 找子组件数组
 */
export function findComponentsDownward(instance: any, componentName: string) {
  // return context.$children.reduce((components, child) => {
  //   if (child.$options.name === componentName) components.push(child);
  //   const foundChilds = findComponentsDownward(child, componentName);
  //   return components.concat(foundChilds);
  // }, []);
}

/**
 * @desc 找子组件
 */
export function findComponentDownward(context, componentName) {
  // const childrens = context.$children;
  // let children = null;
  // if (childrens.length) {
  //   for (const child of childrens) {
  //     const name = child.$options.name;
  //     if (name === componentName) {
  //       children = child;
  //       break;
  //     } else {
  //       children = findComponentDownward(child, componentName);
  //       if (children) break;
  //     }
  //   }
  // }
  // return children;
}
