mirror of
https://github.com/element-plus/element-plus.git
synced 2024-11-21 01:02:59 +08:00
fix(hooks): vm may be null (#12058)
This commit is contained in:
parent
b5bf0ebf30
commit
8b3250217e
@ -2,6 +2,6 @@ import { computed, getCurrentInstance } from 'vue'
|
||||
import type { ComputedRef } from 'vue'
|
||||
|
||||
export const useProp = <T>(name: string): ComputedRef<T | undefined> => {
|
||||
const vm = getCurrentInstance()!
|
||||
return computed(() => (vm.proxy?.$props as any)[name] ?? undefined)
|
||||
const vm = getCurrentInstance()
|
||||
return computed(() => (vm?.proxy?.$props as any)?.[name])
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user