mirror of
https://github.com/youzan/vant.git
synced 2025-10-16 16:04:04 +00:00
types(@vant/use): relation key can be symbol
This commit is contained in:
@@ -48,14 +48,14 @@ export default {
|
||||
|
||||
```ts
|
||||
function useParent<T>(
|
||||
key: string
|
||||
key: string | symbol
|
||||
): {
|
||||
parent?: T;
|
||||
index?: Ref<number>;
|
||||
};
|
||||
|
||||
function useChildren(
|
||||
key: string
|
||||
key: string | symbol
|
||||
): {
|
||||
children: ComponentPublicInstance[];
|
||||
linkChildren: (value: any) => void;
|
||||
|
@@ -59,7 +59,7 @@ export function sortChildren(
|
||||
});
|
||||
}
|
||||
|
||||
export function useChildren(key: string) {
|
||||
export function useChildren(key: string | symbol) {
|
||||
const publicChildren: PublicInstance[] = reactive([]);
|
||||
const internalChildren: InternalInstance[] = reactive([]);
|
||||
const parent = getCurrentInstance()!;
|
||||
@@ -101,7 +101,7 @@ type ParentProvide<T> = T & {
|
||||
internalChildren: InternalInstance[];
|
||||
};
|
||||
|
||||
export function useParent<T>(key: string) {
|
||||
export function useParent<T>(key: string | symbol) {
|
||||
const parent = inject<ParentProvide<T> | null>(key, null);
|
||||
|
||||
if (parent) {
|
||||
|
Reference in New Issue
Block a user