findVueComponent
liz-q 2020/12/28
获取 vue 子组件
findVueComponent(context, componentName, cb)
# 参数
context
(this.$root) :vue 根实例componentName
(String) :查找组件名称,name 值cb
((childComp) => Boolean) :精确查找的条件函数。默认是 (comp) => true,如果自定义传入在componentName
匹配上的同时要满足 cb 返回 true
# 返回值
(VNode) :vue 组件实例
# 例子
import { findVueComponent } from '@liz-q/utils'
const ListComp = findVueComponent(this.$root, 'List')
const DetailComp = findVueComponent(this.$root, 'Detail', (comp) => {
// ...
return true
})