2024-11-05 10:14:41 +08:00

11 lines
346 B
TypeScript

import { computed, getCurrentInstance } from 'vue'
import { isEmptyVariableInDefault } from '../../utils'
import type { ComputedRef } from 'vue'
export const useProp = <T>(name: string): ComputedRef<T | undefined> => {
const vm = getCurrentInstance()
return computed(
() => isEmptyVariableInDefault(vm?.proxy?.$props as any)[name]
)
}