chore: minor tweaks

This commit is contained in:
daiwei 2025-02-17 17:21:58 +08:00
parent 8420ff32dd
commit 5b53f8e209
1 changed files with 5 additions and 2 deletions

View File

@ -12,8 +12,11 @@ export function useTemplateRef<T = unknown, Keys extends string = string>(
const r = shallowRef(null)
if (i) {
const refs = i.refs === EMPTY_OBJ ? (i.refs = {}) : i.refs
const desc = Object.getOwnPropertyDescriptor(refs, key)
if (desc && !desc.configurable) {
let desc: PropertyDescriptor | undefined
if (
(desc = Object.getOwnPropertyDescriptor(refs, key)) &&
!desc.configurable
) {
if (__DEV__) {
warn(`useTemplateRef('${key}') already exists.`)
}