feat: support specifying allowed keys via generic argument in useTemplateRef()

This commit is contained in:
Evan You 2024-08-01 11:13:56 +08:00
parent f6babf3236
commit 1fbfa6962b
No known key found for this signature in database
GPG Key ID: 00E9AB7A6704CE0A
1 changed files with 2 additions and 2 deletions

View File

@ -3,8 +3,8 @@ import { getCurrentInstance } from '../component'
import { warn } from '../warning' import { warn } from '../warning'
import { EMPTY_OBJ } from '@vue/shared' import { EMPTY_OBJ } from '@vue/shared'
export function useTemplateRef<T = unknown>( export function useTemplateRef<T = unknown, Keys extends string = string>(
key: string, key: Keys,
): Readonly<ShallowRef<T | null>> { ): Readonly<ShallowRef<T | null>> {
const i = getCurrentInstance() const i = getCurrentInstance()
const r = shallowRef(null) const r = shallowRef(null)