types(@vant/use): useRelation support InjectionKey (#9015)
This commit is contained in:
@@ -3,6 +3,7 @@ import {
|
||||
isVNode,
|
||||
provide,
|
||||
reactive,
|
||||
InjectionKey,
|
||||
getCurrentInstance,
|
||||
VNodeNormalizedChildren,
|
||||
ComponentPublicInstance,
|
||||
@@ -57,13 +58,15 @@ export function sortChildren(
|
||||
}
|
||||
|
||||
export function useChildren<
|
||||
Child extends ComponentPublicInstance = ComponentPublicInstance
|
||||
>(key: string | symbol) {
|
||||
// eslint-disable-next-line
|
||||
Child extends ComponentPublicInstance = ComponentPublicInstance<{}, any>,
|
||||
ProvideValue = never
|
||||
>(key: InjectionKey<ProvideValue>) {
|
||||
const publicChildren: Child[] = reactive([]);
|
||||
const internalChildren: ComponentInternalInstance[] = reactive([]);
|
||||
const parent = getCurrentInstance()!;
|
||||
|
||||
const linkChildren = (value?: any) => {
|
||||
const linkChildren = (value?: ProvideValue) => {
|
||||
const link = (child: ComponentInternalInstance) => {
|
||||
if (child.proxy) {
|
||||
internalChildren.push(child);
|
||||
|
||||
Reference in New Issue
Block a user